[systemd-devel] proper way for shutdown script
lennart at poettering.net
Wed Oct 5 11:16:27 UTC 2016
On Wed, 05.10.16 12:47, Xen (list at xenhideout.nl) wrote:
> the libnss-ldap package on my system used to contain (and still contains) a
> script that is run on system reboot and shutdown and installs itself into
> SysV directories for runlevel 0 and 6.
> However on SystemD I believe these are not run? What would be the proper way
> to run them?
Why does nss-ldap require something like this? Sounds strange to me...
What you probably want to do is write a single unit file with an
ExecStart= and an ExecStop= line invoking the right bits to call
during boot and those for shutdown. You want to set Type=oneshot and
The above should be good enough if your scripts may run during the
normal start-up phase and normal shutdown phase, i.e. after all basic
initialization of the system (such as device probing, kernel config,
and mounting of file systems is done) is completed, in parallel to
normal system services.
If you however, need this stuff during early boot, i.e. before other
regular services are started things get more complicated, as you need
DefaultDependencies=no in this case, and declare precisely before and
after which other early-boot initiatlization services you want to be
Lennart Poettering, Red Hat
More information about the systemd-devel