[systemd-devel] Is there a general inittab entry replacement available?

Tomasz Torcz tomek at pipebreaker.pl
Tue May 22 12:42:23 PDT 2012


On Tue, May 22, 2012 at 09:27:34PM +0200, Joachim Banzhaf wrote:
> As it happens I also like IBM DB2 a lot (for other reasons).
> DB2 is closed source (I hope you dont stop reading now) and it installs
> an inittab entry.
> 
> fmc:2345:respawn:/opt/ibm/db2/V10.1/bin/db2fmcd #DB2 Fault Monitor
> Coordinator
> 
> You know that this does no longer work.
> 
> Inittab is a very old, very widely spread concept so I have hope you
> even have thought about porting something like this in a generic way
> already and I just failed to find it?

  inittab is not used on general Linux for few years already.  Most distros
switched to upstart some time ago, upstart isn't parsing inittab (except
for default runlevel).

  The line you provided translates to following systemd unit:
/etc/systemd/system/fmc.service
---
[Unit]
Description=DB2 Fault Monitor Coordinator

[Service]
ExecStart=/opt/ibm/db2/V10.1/bin/db2fmcd
Restart=always

[Install]
WantedBy=multi-user.target
---

  It simple, but let me describe it:

"fmc" becomes service name - fmc.service

"2345" is not directly mappable.  There are no runlevels with systemd.

multi-user.target is roughly equivalent of all system services started.
If your inittab had "1" here (single user), you would want WantedBy=rescue.target
in [Install] session. Please see "man systemd.special" for description of
other targets.

"respawn" becomes Restart=always

The command itself lands in ExecStart=; because this command do not daemonize
(requisite for being in inittab), you can skip Type= declaration. It will
default to simple.

You can put comment in Description field.

  You are now only "systemctl enable fmc.service" away of emulating inittab.

  Above unit definition is really simple but fully replaces inittab entry.
However, please look at man pages of systemd.exec and systemd.service. You will
find many way to augment this unit (various limits, chroot, running as specific
user, group etc).


-- 
Tomasz Torcz                                                       72->|   80->|
xmpp: zdzichubg at chrome.pl                                          72->|   80->|



More information about the systemd-devel mailing list