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

3 Answers 3


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.


exit 0
  • What is the exact difference way os usage of this file from using os run-level directory files? Nov 2, 2012 at 8:10
  • I have created same file at both /etc/rc2.d /etc/rc3/d folder but it does not either. I am testing this functionality via reboot command. Nov 2, 2012 at 9:04

runlevel 6 is used during reboot. http://www.debian-administration.org/articles/212

try using /etc/rc2.d and name it S99startup.sh the S prefix is for Start and the K prefix is for Kill.


That's normal. Linux runlevel 6 is reboot/shutdown. What you're looking for is runlevel 3 or/and 5.

The standard tools for managing startup scripts are chkconfig or update.rc. But if you want to be "on the edge" you can use upstart - which was presented in Ubuntu some time ago.

Upstart jobs are located under /etc/init- you just have to copy an existing job and use it as example/template to write your own job for your script. Most of the people recommend looking at /etc/init/mysql.conf and start from there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.