[systemd-devel] Starting a service at shutdown time, with requirements

Simon McVittie smcv at collabora.com
Tue Mar 20 19:26:09 UTC 2018


On Tue, 20 Mar 2018 at 19:16:59 +0000, Mantas Mikulėnas wrote:
> On Tue, Mar 20, 2018, 21:09 Colin Walters <walters at verbum.org> wrote:
>     Another way I've thought about handling this is to basically invert things
>     so that
>     we have a "stub" unit that starts on bootup, and its ExecStop does the real
>     work
> 
> Currently this is the recommended method; it's a little ugly indeed but fits
> quite well into the shutdown process. Recent systemd versions should let you
> skip the dummy ExecStart.

The unattended-upgrades tool on Debian/Ubuntu works like this when
configured to install updates during shutdown (the same idea as systemd's
"reboot to a special mode, install updates, reboot again", but with fewer
reboots). I can confirm that in recent-ish systemd (v232 in Debian 9,
although not the older v215 in Debian 8) the ExecStart is unnecessary.

    smcv


More information about the systemd-devel mailing list