|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
|
| Recommended Links | grub | Runlevels | Xinetd | ||
| YaST |
Humor |
Etc |
As seen in the previous section, the kernel will start a program called init, if it finds it. The init process reads the file "/etc/inittab" and uses this file to determine how to create processes. Read the init man page for more information. Also note that init is always running and can dynamically do things and run processes based upon various signals. The administrator can also cause it to dynamically change system processes and runlevels by using the telinit program or editing the "/etc/inittab" file. Red Hat as well as most of its derivatives including Suse uses run levels in a following way:
Which services are started in which runlevels can be managed with the chkconfig tool, which keeps its configuration settings in a elaborate arrangement under /etc/rc.d/.
/sbin/chkconfig --list lists all the services controlled by chkconfig and whether they are on/off for each runlevel. Setting a service A controlled by chkconfig, for levels X, Y and Z is achieved using /etc/chkconfig --level XYZ A
See Runlevel - Wikipedia, the free encyclopedia
Default level is defined in /etc/inittab, for example id:5:initdefault
The "/etc/inittab" file tells init which runlevel to start the system at and describes the processes to be run at each runlevel. An entry in the inittab file has the following format:
id:runlevels:action:process
# inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> # Modified for RHS Linux by Marc Ewing and Donnie Barnes # # Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # 1) id:3:initdefault: # System initialization. 2) si::sysinit:/etc/rc.d/rc.sysinit 3) l0:0:wait:/etc/rc.d/rc 0 4) l1:1:wait:/etc/rc.d/rc 1 5) l2:2:wait:/etc/rc.d/rc 2 6) l3:3:wait:/etc/rc.d/rc 3 7) l4:4:wait:/etc/rc.d/rc 4 8) l5:5:wait:/etc/rc.d/rc 5 9) l6:6:wait:/etc/rc.d/rc 6 # Things to run in every runlevel. 10) ud::once:/sbin/update # Trap CTRL-ALT-DELETE 11) ca::ctrlaltdel:/sbin/shutdown -t3 -r now # When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. 12) pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" # If power was restored before the shutdown kicked in, cancel it. 13) pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" # Run gettys in standard runlevels 14) 1:2345:respawn:/sbin/mingetty tty1 15) 2:2345:respawn:/sbin/mingetty tty2 16) 3:2345:respawn:/sbin/mingetty tty3 17) 4:2345:respawn:/sbin/mingetty tty4 18) 5:2345:respawn:/sbin/mingetty tty5 19) 6:2345:respawn:/sbin/mingetty tty6 # Run xdm in runlevel 5 # xdm is now a separate service 20) x:5:respawn:/etc/X11/prefdm -nodaemonOn the left side of the file listing, above, are added numbers to help describe lines. Those lines without line numbers are either blank or begin with a "#" which means the line is a comment. Those line numbers are not part of the original file and are added here for reference purposes.
Note the order of programs to run as specified above are:
Therefore, the next thing that the system does is to run the rc.sysinit file, save buffers to the hard drive, then run system script files for the requested runlevel which will start up many system and network services as explained in the next section.
The default boot runlevel is set in the file /etc/inittab with the initdefault variable. When set to 3, the system boots up with the text interface on the VGA console; when set to 5, you get the GUI. Here is a snippet of the file (delete the initdefault line you don't need):
# Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:3:initdefault: # Console Text Mode id:5:initdefault: # Console GUI Mode
Note the following:
Copyright © 1996-2008 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.
Last modified: November 08, 2008