I've read the answers to this and similar questions already, but so far none had worked for me.
On my Ubuntu 11.10 (oneiric) system, all the files in /etc/rc0.d/
and /etc/rc0.d/
are links. I put my script (called shutdown_script) in the /etc/init.d/
directory and created two symbolic links to it, one in /etc/rc0.d/
and the other in /etc/rc6.d
, both with the name K99shutdown_script. The script is not being run at shutdown, which is what I want. The script is just to test if I could run a script at shutdown; I supply the code in shutdown_script below:
#!/bin/sh
#
# Tests script to run at shutdown.
# Script creates a fil and writes to it.
#
# Usage: ./shutdown-script
touch $HOME/shutdown.log
echo "Shutting down at `date` ..." >> $HOME/shutdown.log
As you can see, it just adds a file to the home folder showing the current date and time.
Please could you tell me what I may be doing wrong, and more importantly, how to get a script to run at shutdown.