Familiar with linux core configuration file inittab

Source: Internet
Author: User
Article Title: familiar with linux core configuration file inittab. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
In the jar, I saw someone asking questions about the inittab file. I found some information and summarized it. Please give me more comments and add more!
  
The init process is the parent process of all processes in the system. The init process generates sub-processes required to complete common operations, including: set the machine name, check and install the disk and file system, start the system log, configure the network interface, start the network and mail service, and start the Print Service. In Solaris, the main task of the init process is to create a process according to the information provided by the inittab file. Because all the processes initialized by the system are created by init, The init process is also called the system initialization process. The following describes the format of the inittab file.
  
Each record in the inittab file starts from a new line. Each record item can contain a maximum of 512 characters. The format of each record is usually as follows: id: rstate: action: process.
  
1. The id field is a string of up to four characters, used to uniquely identify a table item.
  
2. the rstate (run state) field defines the running level of the record item when it is called. The rstate can be composed of one or more running levels, or it can be empty. If it is null, it indicates the running level 0 ~ 6. When the init is requested to change the running level, processes that do not include the new running level in the rstate field will receive the SIGTERM warning signal and finally be killed; only commands started by a, B, and c (a, B, and c are not real running levels)
  
3. The action field tells init how to process the process specified by the process field. The values and corresponding actions of the action field are as follows:
  
1) respawn: if the process specified by the process field does not exist, start the process. init continues to scan the subsequent processes in the inittab file. When the process ends, init restarts it. If such a process already exists, nothing will be done.
  
2) wait: start the process specified by the process Field and wait until the processing is completed to process the next record in the inittab.
  
3) once: start the process specified by the process Field and process the next record item before the process ends. When such a process is terminated, it will not be restarted. When it enters the new running level, if such a process is still running, init will not restart it.
  
4) boot: init processes such records only when the system is started. It starts the corresponding process and processes the next record item without waiting for the processing to complete. When such a process is terminated, the system does not restart it.
  
5) bootwait: After the system is started, it processes such records when it enters multi-user mode for the first time from single-user mode. init starts such a process and waits until its processing ends, then the next record item is processed. When such a process is terminated, the system does not restart it.
  
6) powerfail: When init receives a power-off signal (SIGPWR), IT processes the specified process.
  
7) powerwait: When init receives a power-off signal (SIGPWR), IT processes the specified process and checks other record items until the processing ends.
  
8) off: if the specified process is running, init sends a SIGTERM warning signal to it, waiting for 5 seconds before the SIGKILL command is executed. If the process does not exist, ignore this item.
  
9) ondemand: the respawn function is used only for record items whose rstate field is a, B, and c.
  
10) sysinit: the specified process is executed before accessing the console. Such record items are only used for initialization of certain devices, the purpose is to enable init to ask the user about the running level on such a device. init needs to wait until the process finishes running.
  
11) initdefault: Specifies a default running level. This item is scanned only when init is called at the beginning. If the rstate field specifies multiple running levels, the maximum number is the default running level. If the rstate field is empty, init considers the field to be 0123456, and then enters Level 6, which leads to a loop, if the inittab file does not contain the initdefault record item, you are requested to specify an initial running level for it at system startup.
  
4. The Process in the Process field can be any waiting Process, executable script or program.
  
In addition, you can add new record items in the file inittab at any time. Level Q/q does not change the current running level, and re-check the inittab file, you can run init Q or init q to re-read the init process and process the file inittab.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.