I'm running Ubuntu where I have the directories /etc/rc0.d
, /etc/rc1.d
, /etc/rc2.d
, ..., /etc/rc6.d
.
Example files from my machine:
directory example symlinks in the dir
------------------------------------------
/etc/rc1.d: K76dovecot, K77ntp
/etc/rc2.d: S23ntp, S24dovecot
/etc/rc3.d: S23ntp, S24dovecot
/etc/rc4.d: S23ntp, S24dovecot
/etc/rc5.d: S23ntp, S24dovecot
Questions:
- What's the purpose of the multiple "rc" directories?
- Why did Ubuntu install duplicates of
dovecot
andntp
into all the directories exceptrc0.d
andrc6.d
? - If they are specified multiple times like above, are they actually executed multiple times?
- Can you tell from the above in what order
dovecot
andntp
will execute at startup? - What is the proper way to tell Ubuntu to always execute
ntp
beforedovecot
at startup?
S01bluetooth
andS01rsync
, will the order be arbitrary? – direprobs Sep 15 '17 at 20:48S01
the comparison will beb
<r
, you get the idea. Maybe! – direprobs Sep 15 '17 at 22:05/etc/init.d/rc
saysfor s in /etc/rc$runlevel/S*; do …
, so it simply goes in glob expansion order; i.e., numeric / alphabetic. The long answer is that the code in there is a lot more complicated than I remember. I'll try to spend some serious time studying it sometime within the next six to eight weeks. At first glance, it looks like it's extracting the number after theS
and doing something with it, soS42beeblebrox
andS42zaphod
might be more tightly associated than, say,S43arthur
andS44dent
. – G-Man Says 'Reinstate Monica' Sep 15 '17 at 22:39