Sample Header Ad - 728x90

How to run a script at shutdown on Debian 9 or Raspbian 8 (Jessie)

4 votes
3 answers
15842 views
I would like to execute this shell script at reboot and shut down: #!/bin/sh touch /test Its permissions are -rwxr-xr-x 1 root root 22 Feb 24 09:34 /etc/init.d/te1 And it has this links /etc/rc0.d/K01te1 -> ../init.d/te1 /etc/rc6.d/K01te1 -> ../init.d/te1 It is working at start up if I have a this link /etc/rc5.d/S01te1 -> ../init.d/te1 But I need it running at shut down. How can I do this on Debian 8 and 9 testing? The [suggestion](https://unix.stackexchange.com/a/276808/159562) touch /var/lock/subsys/te1 didn't work.
Asked by Frank Breitling (1029 rep)
Feb 24, 2017, 09:21 AM
Last activity: Nov 20, 2018, 10:40 PM