Bug#856031: systemd: /lib/systemd/system-shutdown/ is ignored

Frank Breitling frank.breitling at gmx.de
Fri Feb 24 14:53:37 GMT 2017



On 24.02.2017 14:42, Michael Biebl wrote:
> Control: forcemerge -1 856028
>
>
> Am 24.02.2017 um 14:28 schrieb Frank Breitling:
>> Package: systemd
>> Version: 232-18
>> Severity: normal
>>
>> Dear Maintainer,
>>
>>     I need to run a script at shutdown and reboot.
>>
>>     Linking my script to /etc/rc0.d and rc6.d was not successful so I added
>>        my script to /lib/systemd/system-shutdown/.
>>
>>     However, my script was never executed at shutdown or reboot.
>>
>>     But it should have run. It has this contents:
>>        "#/bin/sh
>>           touch /test"
>>
> Three things:
>
> First, your script does not have a proper shebang (missing !), use
> #!/bin/sh
>
> Second, check that the script you created is actually executable (chmod
> +x ...).
>
> Third, / might already be read-only at the time the script is run. You
> need to explicitly remount / rw, i.e. something like
>
> #!/bin/sh
> mount -oremount,rw /
> touch /test
> mount -oremount,ro /

Thanks a lot for your answer.

1) Was a typo in the report, but not in the script.
2) Permissions were set correctly.
3) You are correct. Changing the script as you suggested made it work!

So I can confirm that it is executed and working correctly.
And this is not a bug and can be closed!

Now it seem to me that the system-shutdown folder is not the right place 
for my script.
But my first idea to link my script to /etc/rc0.d and rc6.d was not 
successful (http://unix.stackexchange.com/q/347275/159562).
So I am wondering why this was not working and what to do instead?
Is a systemd .service file the only solution?




More information about the Pkg-systemd-maintainers mailing list