Linux – Run Linux script at startup

linuxubuntu-12.04

Although I have created a file in /etc/rc0 directory to get it run at startup I does not execute.
On the contrary when same file is created at /etc/rc6 directory, it gets executed upon shuting down.

K99startup.sh -> ../init.d/startup.sh*

I am using Ubuntu 12.04

Best Answer

You can call the script from /etc/rc.local which is the correct place for custom scripts to run at startup.

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/usr/local/bin/your-script

exit 0