[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to make systemd execute init.d script status statements?



On 2016-05-16 21:36 +0300, Juha Heinanen wrote:

> When I upgraded one of my wheezy hosts to jessie, I noticed that
>
> /etc/init.d/<my own daemon> status
>
> command stopped working.
>
> Looks like systemd does not execute the statements in status) case of
> the init script at all, but just checks if the daemon process exists.

Actually it does a bit more than that, but the bottom line is that (for
scripts that source /lib/lsb/init-functions, which every init script in
Debian is supposed to do) /lib/lsb/init-functions.d/40-systemd ensures
that "/etc/init.d/<script> <action>" is redirected to
"systemctl <action> <script>.service" for the common values of <action>,
i.e. start, stop, restart, reload, force-reload, status.  This is
usually what you want, but there is a magic environment variable that
lets you skip the redirect.

> My '/etc/init.d/<my own daemon> status' did much more, i.e., it checked
> if the daemon was actually able to do some real work.

Use "_SYSTEMCTL_SKIP_REDIRECT=true /etc/init.d/<my own daemon> status",
and your init script won't redirect to systemctl.

Cheers,
       Sven


Reply to: