[systemd-devel] proper way for shutdown script
list at xenhideout.nl
Wed Oct 5 12:37:33 UTC 2016
Lennart Poettering schreef op 05-10-2016 13:16:
> Why does nss-ldap require something like this? Sounds strange to me...
Thanks man. I was just gonna charge you $40 for missed time... ;-).
There are services during startup that are going to hang if you
configure nsswitch.conf to also use ldap for e.g. passwd or group.
What this means is that in ldap.conf they have enabled something that
will refuse ldap lookup for those kinds of users.
The script I mentioned adds this to the ldap.conf:
It does this just based on a numeric ID, so all user IDs and group IDs
(presumably) below probably 1000 are getting added there.
This is done on shutdown so it works right after installing the package.
If you don't do it, the system won't boot and will hang on
logind.service even not starting.
Raise Network Interfaces will also fail.
But currently this is broken because the thing doesn't run by default
and you manually have to run /usr/sbin/nssldap-update-ignoreusers but if
you install more programs (services) in the meantime, this of course
will have to be repeated. So it just does it on every reboot.
> 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
I spent at least an hour trying to run something that would only run on
shutdown and at some point it seemed to work but then I could not
reproduce it. I had....
Description=Run script at shutdown and reboot
But no good....
I found a solution on Arch forums that would do:
And this works. But now the service must be started first before it will
be called on shutdown... :-/.
Which pollutes the boot-up log and there is really no reason for it?
You can still pay the money though, if you want ;-).
I started doing this about 2 hours ago and haven't done anything
since... anything else, I mean.
More information about the systemd-devel