I have a hierarchy of programs running which have a very specific start and stop order. I think I got the run levels set appropriately, but I'm having issues with some of them not working in the order intended. Is there a way to step through the start-up and shutdown so I can see what's going on as it happens?

  • You can change run levels with telinit (8) command. If run from the console than you can see the services starting or stopping. – Hennes Oct 15 '12 at 20:54
  • Any way to actually step through the run level change? – ohshazbot Oct 15 '12 at 21:27
  • None that I know off. Just changing whole levels, or manually starting/stopping services. – Hennes Oct 15 '12 at 21:44
  • I wonder if I could emulate it with for file in /etc/rc(number).d/*; do sudo $file stop; done? Is that basically how it runs, with the assumption that the sort order is the same? – ohshazbot Oct 15 '12 at 21:55
  • 1
    I am not sure how Ubuntu orders it. Alphabetical order is unlikely though. There will be some kind of intelligent order (like bring up network before bring up NFS). -- The people on our sister site askubuntu.com might have more helpful information. – Hennes Oct 15 '12 at 22:03

The way debian/ubuntu orders the rc(number).d bootup is:

0 to 6 for the runlevel, 0 for halt, 6 for reboot, etc.

K at the beginning of the link for Kill.

S at the beginning of the link for Start.

The number after the K/S is the order in which they start inside each run level from low to high.


/etc/rc3.d/S20apache2 -> ../init.d/apache2

starts before:

/etc/rc3.d/S75sudo -> ../init.d/sudo

The comand to update the runlevels is update-rc.d.

example from debuntu:

  • starting apache with priority 20 on runlevels 2, 3, 4 and 5 and Kill with priority 80 on runlevels 0, 1 and 6

    update-rc.d apache2 start 20 2 3 4 5 . stop 80 0 1 6 
  • 1
    That's true. However, the deeper answer is that update-rc.d automatically figures out the priorities by looking at the dependencies declared in each init script's header comments. See the update-rc.d(8) and insserv(8) man pages. You should avoid manually managing the start/stop priorities and declare your dependencies instead. – 200_success Aug 26 '13 at 19:49

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.