At any time, the system is in the following 8 operational levels available: 0~6, s=s. The primary function of/sbin/init or/etc/telinit (link) is to create its child processes based on the definitions in the/etc/inittab file.
During operating system boot, the init process is activated and reads environment variables about time zones and languages from/etc/default/init, and then checks the default level in/etc/inittab (prompting user input if it does not exist) and spawn ("Hatch") All processes defined by this level.
After initialization, the INIT process enters the wait state, waiting for the following event to occur: a subprocess defined as a respawn type terminates; a power failure signal; Other init processes change the system's running level.
A new entry can be added to the/etc/inittab file, and you can use INIT-Q to force the INIT process to immediately review the information in that file.
Upon receipt of the change run level request, the INIT process emits a warning signal sigterm for each process not defined by the target level, and then emits a sigkill signal after 5 seconds to force the process to terminate
When a process is created, it is recorded in the/var/adm/wtmp, and at/var/adm/utmp when it is terminated.
After receiving the SIGPWR signal, the init process checks the/etc/inittab for Powerfail and powerwait type entries and executes them immediately.
The sync command synchronizes the hard drive buffers.
The run level includes (3, S, 0, 6) that are commonly used:
0:firmware, you can safely shut down the machine.
1: System administrator status, mount all file systems, keep a small number of basic kernel processes, no user login.
2: Multi-user status
3: Extended multiuser status, all resources available on the network
4: Can be defined as the optional multiuser State,
5: Shut the system down for power off
6: Stop the OS and reboot to the default level.
S=s, single user state, only root login.
The parameters for command init are:
A,B,C: Executes specific commands in Inittab without changing the current run level.
Q=q, check/etc/inittab again.
Shutdown command can enter S class