[systemd-devel] proper way for shutdown script
list at xenhideout.nl
Wed Oct 5 16:01:55 UTC 2016
Lennart Poettering schreef op 05-10-2016 14:52:
> Urgs, what an ugly approach...
Still better than a non-booting system :p. So apparently this situation
has already existed for quite some time.
Even worse is that by default the ldap configuration is set to
bind-policy = hard, which can also create this issue (a failing LDAP
query will then never return, or only return after a long timeout).
> It's the way to go on systemd. With current systemd you should be able
> to leave out the ExecStart=/bin/true bit, if you only care about
> But as I understood you actually wanted to run something both at boot
> and at shutdown, hence why would you not make use of ExecStart= as
> well here?
No that's not true.
I only wanted shutdown.
If the service never gets started how can it shut down?
ExecStop does weird things on services that are oneshot but not
RemainAfterStart, at least.
> Note that the above unit file you posted is a bit contradictory: if
> you plug something into sysinit.target then your service should be an
> early-boot service, and those have to have the DefaultDependencies=no
> setting, as they need to configure their preicse ordering manually,
> instead of relying on the generic dependencies.
I realized that, but it works :p. The reason I picked it like this is
because it *seems* that you might have rescue mode situations in which
basic.target is never reached, neither is multi-user.target ever
reached, but sysinit.target will be reached?
Since this is about the system remaining bootable I considered it reason
enough to pick it like this :p.
> hence, either change the Wantedby= setting to
> WantedBy=multi-user.target and make the service a proper late-boot
> service, or also set DefaultDEpendencies=no and add the appropriate,
> manual early-boot dependencies.
Ya ya, it was documented also. I read it.
More information about the systemd-devel