Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

On a system that uses SysV init run levels such as Centos 5, when the OS is booting, does it go straight to the run level defined in /etc/inittab?

If I change my run level using the init command do the kill scripts for my current run level execute and then the start up scripts for the new run level execute?

For example if I was at run level 3 and entered init 1, would the kill scripts in /etc/rc.d/rc3.d be executed and then upon entering run level 1 would the startup scripts in /etc/rc.d/rc1.d be run?

share|improve this question
1  
Any chance of someone with more rep adding a runlevel tag? –  Kev Jul 26 '11 at 15:55
add comment

1 Answer

up vote 4 down vote accepted

Yes, SysVinit goes straight to the chosen run-level on boot without looking at scripts in other levels. You can view the runlevel history using the runlevel command. On first boot, it will show the "previous" runlevel as 'N'. After a runlevel change it will show the previous and current runlevel.

When switching runlevel, it first looks at the difference between them. Any services that are listed in the current level but not in the new one are first killed using the kill scripts, then any that are listed in the new level but not in the old one are run. Services that exist in both run levels are not touched.

For example switching from runlevel 3 to 5 will usually result in a few things (like a display manager) being started, but nothing killed. Switching from 5 to 1 will result in quite a few things being killed, then maybe 1 (like a single user interface console manager) being run.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.