0

I'm trying to understand what goes on when I start up a linux server. My linux server has files /etc/rc2.d/S03cron, /etc/rc3.d/S03cron, /etc/rc4.d/S03cron, /etc/rc5.d/S03cron which should start the cron daemon 4 times. once at each of those run levels. why is there only one cron process on my system? did it try to start the process 4 times but only the first one works? does the system immediately go to runlevel 5? or does it go through S, 1, 2, 3, 4, 5 like that?

  • read more about initscripts, or manually try to start again a running service. – Ipor Sircer Nov 8 '16 at 1:00
2

This depends on what init system you are using. In some init systems — old Solaris or SunOS, I think, although it's been way too long — the runlevels are cumulative in the way you are expecting. In others, including every Linux that uses the runlevel concept that I've ever heard of, they're independent descriptions of what things should be started or stopped at that runlevel (which can lead to messiness if you are going between levels and the K (stop) script is missing).

  • So when the system boots, it combines all the start scripts from run levels S through 5, figures out which are unique, then runs them? – Jake Nov 8 '16 at 1:10
  • 1
    Not usually, no. It looks at the default runlevel, runs all the scripts in that level, and is done. That's why you are only getting one instance of the cron daemon. – mattdm Nov 8 '16 at 1:14
  • Note, by the way, that systemd does not have a concept of runlevels, per se, instead using "targets", which are roughly the same idea but more flexible. – mattdm Nov 8 '16 at 1:15
  • Ok that makes sense. I still don't see why someone would need so many run levels though. – Jake Nov 8 '16 at 2:16
  • @Jake In practice, one generally didn't need that many. – mattdm Nov 8 '16 at 2:22

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.