action (role: inform the init command how to handle the process field to specify the process) |
( 1 ) respawnif the process does not exist, start the process. Do not wait for process termination (continue scanning the / etc / inittab file). If it dies, then restart the process. If the process exists, continue scanning the / etc / inittab file For example: "5:2345: respawn: / sbin / mingetty TTY5 " Explained: init will open a local terminal, when the terminal over time no one login or too long no one keystroke, this terminal will not be executed, respawn that tells init re-run the terminal, otherwise, after a period of time We will find that this terminal is gone, can not use ALT + F5 switch |
( 2 ) waitwhen the init command to enter matches the entry's run level, start the process and wait for the process to terminate. When the init command in the same run level, all of the / etc / inittab file will cause the next read init command to ignore this entry |
( 3 ) oncewhen the init command to enter matches the entry's run level, start the process, and do not wait for the termination. When it dies, do not restart the process. When the system enters a new run level, the process continues from the previous run level change operation, do not restart the program |
( 4 ) bootonly run during system boot entry, these processes are system startup, init command from / etc / inittab file to read, so runlevel value of its invalid. Start the process, do not wait for its termination, and the process dies, do not restart the process. Meaningful guidance followed, should be the default run level, or it must boot init command's run level match. This action restarts the system after the hardware initialization is useful |
( 5 ) bootwaitsystem boot, init command from a single user to multi-user state, the first run of the entries. Start the process, and so its end, the process dies, do not restart the process. If the initdefault is 2 , the system is run directly after the boot process |
( 6 ) powerfailonly when the init command receives a power fail signal (SIGPWr) only when the implementation process associated with this entry, but init will not wait for the end of the process is running ( rH Linux default this option is not listed) |
( 7 ) powerwaitonly when the init command receives a power fail signal (SIGPWr) only when the implementation process associated with this entry, to close the system (of course, provided there is UPS and monitor UPS and informs init software power has been cut off ), and so the process terminates before continuing to process / etc / inittab file ( rH Linux default this option is not listed) |
( 8 ) off if the process associated with this entry is currently running, send a warning signal (SIGTERM) , then wait 20 seconds before kill signal ( SIGKILL ) to terminate the process. If the process is not running, ignore this entry |
( 9 ) OnDemand functionality and respawn the same, but this action application a, b, or c values, instead of run level |
( 10 ) initdefault init command is initially invoked when scanning with this action -related entries. If there is, init command uses this entry to determine the initial run level to enter, due to enter the corresponding run level will activate the corresponding level of process, so its designated process field has no meaning. Under normal circumstances, the use of run-level field, the highest run level specified as the initial state. If the run level field is empty, this is interpreted as 0123456789 ; Thus, init command enters run level 9 . In addition, if the init command in the / etc / inittab file not found initdefault entry in the guide when the user requests an initial run level |
( 11 ) sysinit this type of entries in the registry before the init command tries to access the console before being executed. The entry is only used to initialize the device, init command for these devices may ask the run level. These entries are executed, and wait to complete before continuing |
( 12 ) CtrlAltDel user at the console keyboard, press Ctrl + Alt + Del key combination, allow init to restart the system Note: If the system is in a public place, the system administrator can Ctrl + Alt + Del key combination to configure the other behavior, such as neglect, etc. |
( 13 ) kbrequest monitor to a specific keyboard combination is pressed to take action, now is not perfect
|
command |
Should execute specific commands. Example, the figure in the / etc / init.d / rc command to start running level 2 processes should be run / command, and is responsible for the exit to terminate when run level (of course, enter the runlevel except in the program still running) . When the run level changes, and running the program does not run in the new run level is specified, then init will first send a SIGTErM signal termination, thenSIGKILL 2
. inittab file as follows: # 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) # ID: 3: initdefault: # System initialization. Company:: sysinit: / etc / rc.d / rc.sysinit 10: 0: wait: / etc / rc.d / rc0l1:1: wait: / etc / rc.d / rc 1l2:2: wait: / etc / rc.d / rc 2l3:3: wait: / etc / rc.d / rc 3l4:4: wait: / etc / rc.d / rc 4l5:5: wait: / etc / rc.d / rc 5l6:6: wait: / etc / rc.d / rc 6 # Things to run in every runlevel ud:: once: / sbin / Update # Trap CTRL-ALT-DELETE ca:: CtrlAltDel: / sbin / shutdown-T3 - R now # When our UPS tells U.S. Power has failed, ASSUME We have a few minutes # of Power left. Schedule a shutdown for 2 minutes from now. # This does, of Course, Powerd ASSUME you have installed and your # UPS Connected and Working correctly. PF:: powerfail: / sbin / shutdown-f-H +2 "Power Failure; System Shutting Down" # If Power was restored before the shutdown kicked in, Cancel it. PR: 12345: powerokwait: / sbin / shutdown -c "Power restored; Shutdown Cancelled" # If Power was restored before the shutdown kicked in, Cancel it. PR: 12345: powerokwait: / sbin / shutdown-c "Power restored; Shutdown Cancelled" # run gettys runlevels in Standard 1: 2345: respawn: / sbin / mingetty tty1 2:2345: respawn: / sbin / mingetty tty2 3:2345: respawn: / sbin / mingetty tty3 4:2345: respawn: / sbin / mingetty tty4 5:2345: respawn: / sbin / mingetty tty5 6:2345: respawn: / sbin / mingetty tty6 # run xdm in runlevel 5 x: 5: respawn: / etc/X11/prefdm-nodaemon Note: Case file comments are edited, in order to maintain the written consistency |
[Understand runlevel ] runlevel --- used to represent the init process after the end of the system state, the system's hardware is not fixed information that runlevel , it is simply a software architecture. init and inittab is runlevel affect the system state the only reason. In the above example inittab file comments in the initial stage is mainly used to describe the runlevel : ( 1 ) runlevel = 0 to init the system shut down and terminate all processes
( 2 ) runlevel = 1single-user mode, only the system administrator to enter in this mode have to deal with those in the case of logged-on user can not change the file, change the runlevel number one can also use the S or a single purpose: only minimal services running, so the run-level is often used for system maintenance
( 3 ) runlevel = 2multi-user mode, but does not support file sharing, this model is rarely used
( 4 ) runlevel = 3multi-user mode, but does support file sharing, but also the most server's default mode
( 5 ) runlevel = 4is generally not used by the system, users can design their own system state and apply it to runlevel 4 stages, although rarely used, but the use of the system can achieve some specific logon request
( 6 ) runlevel = 5the system is initialized to a dedicated X Window terminal. Of a powerful Linux system, this is not a good choice, but the user if desired so, it can be in runlevel start to implement the program
( 7 ) runlevel = 6Close all running processes and restart the system
|
process |
This field contains the init execution process, which uses the format of the command line to run the process under the same format, so the process to the field are beginning the process name, followed by a run, followed by a run-time to passed to the process parameters. Such as / sbin / shutdown-T3-R now , the process by pressing Ctrl + Alt + Del is executed, the command line can also enter to restart the system |
|