It represents the state in which the operating system is and operates at a given time.
Example:
A Linux operating system that enters run level 0 will stop, while if it enters run level 6 it is just restarting. Depending on the runlevel in which the operating system goes, there are certain facilities offered and certain running processes. A Linux operating system can be at in a given moment in a single runlevel.
1. Runlevel 0
Halt, shut down
Shutting down the system, bringing it to a state where electricity is interrupted.
2. Runlevel 1
Single-user
a. The single execution level is used for administrative tasks
b. To initialize this mode, init executes a command interpreter under the root user
c. System services are not available, as a demo or other background programs are not available
d. The system can be started in single-mode by providing the Linux kernel with the single command prompt
e. It is possible for the system to start automatically in single mode when problems occur in the startup process that can not be solved automatically (for example, when fsck detects errors that can not be repaired by default)
f. Starting the system can continue to finish the shell execution
Administrator mode is used for maintenance. There is no network, graphics, and only local file systems are mounted. There is a secure user who can login to the system, namely root. It is the equivalent of Windows Safe Mode.
3. Runlevel 2
Non-network multi-user mode.
4. Runlevel 3
multi-user + network
Runlevel default for servers.
5. Runlevel 4
It does not exist
6. Runlevel 5
multi-user + network + graphical environment
Runlevel default for Desktop
7. Runlevel 6
Restart your computer
The script /etc/rc.d/init.d/name is called with the parameter:
a.start – starts the service
b.stop – stops the service
c.restart – restarts the service
d.status – Check if the service is active
use the command service name
There may also be a S or s runlevel that is not used directly, but by programs and scripts that run when you enter runlevel 1. To switch from one runlevel to another, use the command: init new_runlevel
The /etc /inittab file contains entries that define the system actions when it enters each execution level, with the format:
label: list_stars: action: process
a label – the unique tag that identifies each entry (up to 4 characters).
b.list_stars – list of levels to which the entry applies; if it is seen, the entry applies to all execution levels
c.process – the program to be executed
d.action – shows how init treats the executed input process when the system enters a new execution level, init processes all the entries specified for that level, in order of occurrence in the configuration file:
–wait – starts the process and waits for it to end before proceeding to the next entry
–respawn – starts the process and restarts it if it completes its execution (generally used for getty processes)
–once – starts the process only if it does not already run; he does not wait for his conclusion
–boot – execute the process only when the system is booted; awaiting the conclusion
–boot wait – executes the process only when the system starts; awaiting the conclusion
–initdefault – sets the default execution level; usually has the value of 3
–off – if the process runs, it stops
-The process will be executed when that level is called; there will be no change in execution level; levels of this type can be a, b or c
–CTRLALTDEL – the process will be executed when init receives the SIGINT signal (when Ctrl + Alt + Del are pressed on the console)