In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the "process initialization profile inittab process in the Linux system". In the daily operation, I believe that many people have doubts about the process initialization profile inittab process in the Linux system. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubts about the process initialization profile inittab process in the Linux system. Next, please follow the editor to study!
1.label
Label is a unique sequence that identifies an entry of 1-4 characters, and some systems support only 2-character tags. For other login program items such as getty or mingetty, label and tty are required to have the same number, otherwise the getty program will not work properly.
Commonly used labels are:
Id is used to define the default level at which init runs
Si is the process of system initialization
The n in ln ranges from 1 to 6, indicating the level of runlevel that can be used by the process
Ud is the upgrade process
Ca indicates the process to run when Ctrl+Alt+Del is pressed
Pf refers to the process that runs when UPS indicates a power outage
Pr is a process that UPS needs to run when it signals power back on before the system actually shuts down.
X is the process that needs to be run when transferring the system to the X terminal
2.runlevels
Runlevels lists the runlevels and specifies the actions that should be taken. You can specify multiple runlevel levels or not specify a specific value for the runlevel field.
Runlevel 0 tells init to shut down all processes and terminate the system.
Runlevel 1 is used to transfer the system to single-user mode, which can only be entered by the system administrator. In this mode, files that cannot be changed in the presence of logged-in users are processed, and the number 1 of runlevel can also be replaced by S.
Runlevel 2 allows the system to enter multi-user mode, but does not support file sharing, which is rarely used.
Runlevel 3 is the most commonly used mode of operation, mainly used to provide true multi-user mode, which is also the default mode for most servers.
Runlevel 4 is generally not used by the system, users can design their own system state and apply it to the runlevel 4 phase, although rarely used, but the system can be used to achieve some specific login requests.
Runlevel 5 is a dedicated X Window terminal that initializes the system. This is not a good choice for powerful Linux systems, but users can also implement this solution by starting it in runlevel if they need it.
Runlevel 6 shuts down all running processes and restarts the system.
Debian6 does not run the / etc/inittab file by default. The default level is 2-5 and grouped into one class.
3.action
The action field defines the state in which the process should run and describes how the subsequent process will run. :
Respawn restarts the process whenever it terminates
The wait running process waits for input run mode, and this process will start a run level when specified input and init will wait for it to terminate.
Once runs once per runlevel level this procedure will be executed once when the specified input runlevel
Boot runs at system startup, ignoring runlevel
Bootwait runs when the system starts, and init waits for the process to complete. Ignore runlevel
Ctrlaltdel runs when three Ctrl+Alt+Del keys are pressed at the same time, sending the SIGINT signal to init. Ignore runlevel
Initdefault do not execute this process, it is used to set the default runlevel
Kbrequest runs when init receives a signal from the keyboard. The keyboard assembly is required to conform to KeyBoardSigra.
Off is forbidden, so the process does not run
Once runs once at each runlevel level
Ondemand runs when the system specifies specific run levels A, B, and C.
Powerfail runs when init receives a SIGPWR signal
Powerokwait runs when a SIGPWD signal is received and the power status in the / etc/ file contains OK
Powerwait runs when the SIGPWD signal is received and the init waits for the process to end
Sysinit runs before running a boot or bootwait process
4.process
The process field contains the process executed by init in the same format as running the process on the command line, so the process field starts with the process's name, followed by the parameters to be passed to the process at run time.
The code is as follows:
# / etc/inittab: init (8) configuration.
# $Id: inittab,v 1.91 2002-01-25 13:35:21 miquels Exp $
The code is as follows:
# The default runlevel.
Id:2:initdefault: # indicates that the current default runlevel is 2
The code is as follows:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (- b) mode.
Si::sysinit:/etc/init.d/rcS # process of system initialization
The code is as follows:
# What to do in single-user mode.
~: S:wait:/sbin/sulogin
The code is as follows:
# / etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
The code is as follows:
L0:0:wait:/etc/init.d/rc 0
L1:1:wait:/etc/init.d/rc 1
L2:2:wait:/etc/init.d/rc 2
L3:3:wait:/etc/init.d/rc 3
L4:4:wait:/etc/init.d/rc 4
L5:5:wait:/etc/init.d/rc 5
L6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
Z6:6:respawn:/sbin/sulogin
The code is as follows:
# What to do when CTRL-ALT-DEL is pressed. # whether to restart the system by pressing CTRL-ALT-DELETE during startup
# ca:12345:ctrlaltdel:/sbin/shutdown-T1-a-r now
The code is as follows:
# Action on special keypress (ALT-UpArrow).
# kb::kbrequest:/bin/echo "Keyboard Request--edit / etc/inittab to let this work."
The code is as follows:
# What to do when the power fails/returns.
Pf::powerwait:/etc/init.d/powerfail start
Pn::powerfailnow:/etc/init.d/powerfail now
Po::powerokwait:/etc/init.d/powerfail stop
The code is as follows:
# / sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty")
#
# Format:
#:
#
# Note that on most Debian systems tty7 is used by the X Window System
# so if you want to add more getty's go ahead but skip tty7 if you run X.
# getty process to provide services for virtual terminal devices
1:2345:respawn:/sbin/getty 38400 tty1
The code is as follows:
The value of the # label field is 1getty 1 is the numeric suffix of the device tty1, and the tty1 is associated with the corresponding process. The runlevel that the getty process can start are 2Magi 3Jing 4 and 5. When the process terminates, init restarts it immediately. The path name of the startup process is / sbin/getty, which is the minimum version of getty that implements the virtual terminal support and provides tty1 with the process to start the virtual device.
2:23:respawn:/sbin/getty 38400 tty2
# 3:23:respawn:/sbin/getty 38400 tty3
# 4:23:respawn:/sbin/getty 38400 tty4
# 5:23:respawn:/sbin/getty 38400 tty5
# 6:23:respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
#
# T0:23:respawn:/sbin/getty-L ttyS0 9600 vt100
T1:23:respawn:/sbin/getty-L ttyS1 115200 vt100
# Example how to put a getty on a modem line.
#
# T3:23:respawn:/sbin/mgetty-x0-s 57600 ttyS3
5. Example
The code is as follows:
# Begin / etc/inittab
Id:3:initdefault:
Si::sysinit:/etc/rc.d/init.d/rc sysinit
L0:0:wait:/etc/rc.d/init.d/rc 0
L1:S1:wait:/etc/rc.d/init.d/rc 1
L2:2:wait:/etc/rc.d/init.d/rc 2
L3:3:wait:/etc/rc.d/init.d/rc 3
L4:4:wait:/etc/rc.d/init.d/rc 4
L5:5:wait:/etc/rc.d/init.d/rc 5
L6:6:wait:/etc/rc.d/init.d/rc 6
Ca:12345:ctrlaltdel:/sbin/shutdown-T1-a-r now
Su:S016:once:/sbin/sulogin
1:2345:respawn:/sbin/agetty tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600
# End / etc/inittab
At this point, the study on the "process initialization profile inittab process in the Linux system" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.