Introduction to Linux operating level

Source: Internet
Author: User

The operating level of Linux refers to the mode in which Linux works. Linux has 0-6 of these 7 runlevel, which represent the 7 modes that Linux can work on, each of which describes the meaning of these 7 patterns.

0 shutdown, when run level 0, indicates shutdown state

1 single-user mode, the Linux host in this mode of operation only allows the root user and must be logged on locally (note local, not network Telnet), other users cannot log in. This mode is primarily for administrator maintenance, similar to the security mode of Windows. This mode is useful in forgetting the root password, which allows you to enter the system in this mode and modify the root password to reset.

2 Multi-user mode, allows any user to local and telnet, but does not support NFS

3 multi-user mode, and Mode 2 The main difference is that mode 3 can support NFS

4 reserved, no specific practical use

5 graphical mode, system running in mode 5, will support graphical desktop (if installed)

6 Restart mode, when the Linux operating system enters this mode, it will restart, you can also change the default operating level of Linux to 6, this time your main opportunity to enter the continuous restart state.


The 7 operating levels of Linux are covered above, and people unfamiliar with it may ask. When did I run a system on which level was it running? In response to this problem, it can be very straightforward to conclude that it is definitely not level 0, level 6, because if you work at level 0, then your system shuts down directly, level 6 your system will also restart.


RunLevel command: View the current operating level of the system, indicating that the system is now running at level 3

#runlevel N 3

The default operating level of the system startup time, recorded in the file, the Red section is the system default boot level, you can modify the value of the ID to modify the default startup mode.

#cat/etc/inittab# 0-halt (do not set Initdefault to this) # 1-single user mode# 2-multiuser, without NFS (T  He same as 3, if you don't have networking) # 3-full multiuser mode# 4-unused# 5-x11# 6-reboot (does not set Initdefault to this) #:

The Linux host is divided into 7 levels, we can define the seven levels can be run/stop what services or software (except level 0, 6, because these two levels directly shut down or restart the system, the related software or services are not running environment), Here's a detailed description of how to define different levels to run different services and software.


On the Linux host, there is a visual record,

/etc/rc.d/init.d/

There are many Linux-style service management scripts in this directory that govern the related services on the system. We usually manage the use of services [/etc/init.d/xxx status|stop|restart| ...] The command is called the associated script under this directory, because/etc/init.d this directory is actually a linked file, pointing to the

/etc/rc.d/init.d/
#ls/etc/rc.d/init.d/abrt-ccpp ali-system-wide-profiling_agent cgconfig dragoonagent http_status iptables Libvirt-guests#ll init.dlrwxrwxrwx 1 root root-init.d-RC.D/INIT.D

When Linux runs at a certain level, how do you know which services to run? In fact, in order to run or stop a service in a certain mode, you need to create a soft link to the special name of this service in the corresponding/ETC/RC.D/RC (x). d/directory. where x is the corresponding level, as to how this soft link is special, the following is carefully said. Linux has 7 operating modes, so there should be 7 corresponding directories under/ETC./RC.D to store the corresponding services or software that need to be managed.

#ls

INIT.D RC rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d

In turn think, take/etc/rc.d/rc3.d/as an example, this directory below should be level 3 in this mode all the default management software, open this directory

 #ll   /etc/rc.d/rc3.d/total 0lrwxrwxrwx 1 root  ROOT 17 MAR 21  2014 K00IPMIEVD ->&NBSP, .... /init.d/ipmievdlrwxrwxrwx 1 root root 24 mar 21  2014  K01LIBVIRT-GUESTS ->&NBSP, .... /init.d/libvirt-guestslrwxrwxrwx 1 root root 16 mar 21  2014  K01SMARTD ->&NBSP, .... /init.d/smartdlrwxrwxrwx 1 root root 22 mar 21  2014  K02AVAHI-DAEMON ->&NBSP, .... /init.d/avahi-daemonlrwxrwxrwx 1 root root 14 mar 21  2014  S55SSHD ->&NBSP, .... /init.d/sshdlrwxrwxrwx 1 root root 14 jan 28  2015 s58ntpd - >&NBSP, .... /INIT.D/NTPD 

When we find out whether a service or software is running at a certain runlevel, we do need to link the software's startup management script to the path used by this mode. Below we explain how to manage the system when the software is started, or the pattern 3 as an example, indicating that when the system runs in mode 3, the need to manage the relevant software services situation. Let's look at the file name of the corresponding service management script after the soft chain:

K10saslauthd

S85nginx

K represents this operation mode, kills this service,

s represents this run mode, running this service

The two digits after K and S indicate the order in which the system starts and the order is small and needs to be executed first.


When the system starts, the system will first determine the mode of operation (in/etc/inittab to read the running mode, and then go to the corresponding rc.d to get the service that needs to start or stop)


How do I switch the operating level of Linux?

Run init x x directly to the corresponding level.



This article is from the "Chiba Return" blog, please be sure to keep this source http://qianhe.blog.51cto.com/8327382/1698572

Introduction to Linux operating level

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.