InitA process is the initiator and controller of all processes. Because in any Unix-based system suchInux), It is the first running Process, so the init Process ID, PID) is always 1. If there is a problem with init, the rest of the system will collapse.
The init process has two functions. The first role is to play the role of ending the parent process. Because the init process will never be terminated, the system can always be sure of its existence and take it as a reference when necessary. If a process is terminated before the end of all its child processes, the init must be used as a reference. At this time, all child processes that have lost their parent processes will use init as their parent processes. Run the ps-af command to list the processes whose parent Process IDParent Process ID and PPID are 1.
The second role of init is to run the corresponding program at a specific Runlevel to manage various running levels. This function is defined by the/etc/inittab file.
1./etc/inittab File
The/etc/inittab file contains all the information required for the init startup and running level. The format of each statement in this file is as follows:
Id: runlevels: action: process
Note: The statement starting with # Is a comment statement. Look at your own/etc/inittab file and you will find that it is filled with a large number of comment statements. If you do need to make any changes to the/etc/inittab file, this will not happen) Remember to add some comments to explain why you need to make those changes.
2. Telinit command
The mysterious force that notifies init when to switch the system running level is actually the Telinit command. This command has two command line parameters: one parameter is used to notify init to switch the previous running level; the other is-tsec, among them, the sec is the time to wait in seconds before notifying init.
Note: It is up to you to determine whether or not init really switches the running level. Obviously, it often switches, otherwise this command will not be so useful. In most Unix operating systems, including linux), The Telinit command is actually a symbolic link to the init program. Based on this, many people prefer to use init to directly switch to the running level they want instead of Telinit. Personally, I found that using Telinit to switch the running level is easier to understand and remember.
The above is the init in the linux system service. I hope it will help you.
- How to Use Yum to automatically update Linux Server
- Linux System Service: Apache and Tomcat integration skills
- How to customize a Secure Linux System Service Platform
- Debugging notes for Fedora Core Linux system servers
- 8.2.2 initrd. img Image File
- 4.2.4 init_post Function
- Use Linux init to control six login Modes