How to change Linux services startup/boot order?

As the question is clear from the title, how do I change Linux services startup/boot order?


Solution 1:

You can change the order by renaming the symlinks under /etc/rcX.d/ where x will be your run level.

You'll see a bunch of files starting with Sxx or Kxx. S links are traced during startup while the K ones are parsed for shutdown. The xx here represents the order.

But this order is set for a reason, so be careful while changing them.for example. ntpd should start only after the networking subsystem is initialized.

Solution 2:

Instead of doing it manually, like suggested in the other answers, you could also change the init script. Just add such a line to the header:

# chkconfig: 35 90 10

This will instruct chkconfig to add the service to the runlevels 3 and 5, with a start position of 90 and a kill position of 10.