• Important: We recently upgraded our forum software - please let us know if you run into any issues.

Simple - run a script on reboot/shutdown


New Member

I've been pulling my hair out for hours trying to get something so simple to work. Here's what I've done:

1. Created /etc/init.d/reboot-report with permissions -rwxr-xr-x


        echo "test3\n" > /var/www/html/logging/debug

case "$1" in
I shouldn't have to have the case statement, because the script should just run on shutdown, not having a start/stop state. Just did it anyway because it wasn't working without it, so I tried that.

2. update-rc.d didn't create the symlink, so in /etc/rc6.d/, I manually created:
S00reboot-report -> ../init.d/reboot-report
This has full permissions of lrwxrwxrwx.


I read about needing a lock file at /var/lock/subsys/reboot-report. Shouldn't need it, because the script doesn't have a state. It should just run once on shutdown. Regardless, I created an empty file there with touch, but the script still didn't run on reboot. The file disappeared once the machine rebooted.

I did the same for shutdown-report in rc0.d. Doesn't work either.

Any help would be greatly appreciated - my patience is wearing very thin with this.


New Member

I tried the same and the script didn't run. You can run the script at reboot or shutdown using cronjob and for that you need to write the following line in the cronjob.

@reboot /bin/bash /root/test.sh

where /root/test.sh is the script.

Members online

No members online now.

Latest posts