Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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. -> ../init.d/*

I am using Ubuntu 12.04

share|improve this question

migrated from Nov 2 '12 at 9:11

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

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
share|improve this answer
What is the exact difference way os usage of this file from using os run-level directory files? – mmc18 Nov 2 '12 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. – mmc18 Nov 2 '12 at 9:04

runlevel 6 is used during reboot.

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

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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