This question is about Debian, but I guess it's the same in many linux environments.
The /etc/init.d
directory defines the services that run at boot-time. As I see it, there are two mechanisms that define who runs and when:
- runlevel directories - The
/etc/rcN.d/
directories, in which there are symlinks to scripts ininit.d
with numbers that define the running order. These symlinks are generated from runningupdate-rc.d
. - insserv files -
.depend.start/stop/boot
files that are generated from the utilityinsserv
. In these files you see the running scripts underTARGETS
, and the order in which they appear is the running order (See this post)
So first question - Which of these decides the boot order?
In order to change the boot order I guess you can either edit the symlinks name in the rc.N
directories, or change the order of appearence in .depend.start
. But both of these changes will be overwritten by a call to insserv
or update-rc.d
.
So second question - How do you control the boot order init.d scripts in a way that will last after a call to insserv
or update-rc.d
?