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

Joachim Banzhaf joachim.banzhaf at googlemail.com
Wed May 23 08:52:06 PDT 2012


Am 22.05.2012 21:42, schrieb Tomasz Torcz:
> 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).

It works now. Only difference: I had to add this to [Unit] section:
After=remote-fs.target
Before=apache2.service

Without it, the fmc was started but never became operational. Don't know
why.
I assume inittab entries are started sequentially, which in my case
would mean: fmc last. That's why I chose one of the last targets in my
dependency list (I love systemd-analyze plot) and why it worked with
SysV init.




More information about the systemd-devel mailing list