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

How do I make Ubuntu Servers run services at boot time, in a specific order?

I have read a bit about Upstart, init.d and inittab, and I'm not sure what's the right approach for doing it.



share|improve this question
up vote 3 down vote accepted

Look into the command update-rc.d, which is the standard Debian/Ubuntu way to set up starting and halting of services. The file /etc/init.d/skeleton is also a quite nice template for making your own services quickly and with correct behaviour.

share|improve this answer

Aside from upstart (which I don't know much about), order is determined by a number in the rcX.d directory (where X is the run level).

Usually, in Ubuntu, normal use is runlevel 2. You put your script in /etc/init.d/ and make a symbolic link to /etc/rcX.d with the following syntax:

  • S to start or K to stop the service
  • A two digit number with the order of execution (the smaller, the sooner)
  • The name of the script

If your script is number42 do this:

$ sudo cp number42 /etc/init.d
$ sudo ln -s /etc/init.d/number42 /etc/rc2.d/S99number42

Stopping it will be the same but with a K and in runlevel 0 and 6.

sysv-rc-conf can help you visualize which scripts run on which runlevel.


share|improve this answer

You mention in a specific order, but if you mean you have multiple processes, and you need them to run in a specified order, but after all the other boot-time processes have started, you can take the easy way out and use /etc/rc.local.

Simply put all your commands in that file in the order you specify, it will be executed by /bin/sh after all other boot processes have started. Make sure that your process detaches, or append an & to the end of each line or your boot will hang!

The above solutions are more robust, this way is more quick-n-dirty.

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.