这是个很久的知识点了,只是自己一直都迷迷糊糊的,今天在翻出来好好理解下。。
0:停机
1:单用户形式,只root进行维护
2:多用户,不能使用net file system
3:完全多用户
5:图形化
4:安全模式
6:重启
其实,可以通过查看/etc/rc.d/中的rc*.d的文件来对比理解。。
init 0,对应的系统会运行,/etc/rc.d/rc0.d里指定的程序。我们来看下名称。
[[email protected]~]#
ls /etc/rc.d/rc0.d
K01dnsmasqK15ksmtunedK35nmbK60crondK74lm_sensorsK83portreserveK85rpcgssdK88iscsiK90network S00killall
K10cupsK16ksmK35smbK66gpsdK75netfsK84NetworkManagerK85rpcidmapdK88rsyslogK92ip6tables S01halt
K10saslauthdK20nfsK36mysqldK69rpcsvcgssdK75udev-postK84wpa_supplicantK86nfslockK89iscsidK92iptables
K10xfsK25sshdK50haldaemonK70vboxdrvK76openvpnK85mdmonitorK87alsasoundK89netplugdK98qemu
K15gpmK30sendmailK50netconsoleK74acpidK83bluetoothK85messagebusK87rpcbindK89rdiscK99lvm2-monitor
依照上述红色字体,开机会执行的两个进程是killall和halt,这两个都表示为终止进程。故init 0是用于表示关机的。
init 1,对应的系统会运行,/etc/rc.d/rc1.d里指定的程序。
[[email protected] ~] # ls
/etc/rc.d/rc1.d
K01dnsmasqK15ksmtunedK35nmbK60crondK74lm_sensorsK84NetworkManagerK85rpcidmapdK88rsyslogK92ip6tablesS99single
K10cupsK16ksmK35smbK66gpsdK75netfsK84wpa_supplicantK86nfslockK89iscsidK92iptables
K10saslauthdK20nfsK36mysqldK69rpcsvcgssdK76openvpnK85mdmonitorK87alsasoundK89netplugdK98qemu
K10xfsK25sshdK50haldaemonK70vboxdrvK83bluetoothK85messagebusK87rpcbindK89rdiscS02lvm2-monitor
K15gpmK30sendmailK50netconsoleK74acpidK83portreserveK85rpcgssdK88iscsiK90networkS26udev-post
这个级别启动的服务有三个,udev、lvm相关的和single(单用户模式的服务)。故此级别是单用户模式,只有root能用,不支持其他用户。
init 2,对应的系统会运行,/etc/rc.d/rc2.d里指定的程序。
[[email protected] ~ ]# ls
/etc/rc.d/rc2.d/
K01dnsmasqK20nfsK36mysqldK74lm_sensorsK85rpcgssdK89netplugd S08iptablesS23NetworkManagerS30vboxdrvS99local
K10saslauthdK25sshdK50haldaemonK75netfsK85rpcidmapdK89rdisc S12rsyslogS24portreserveS35qemu
K10xfsK30sendmailK50netconsoleK76openvpnK86nfslockK90networkS13rpcbindS25cupsS85gpm
K15ksmtunedK35nmbK66gpsdK83bluetoothK88iscsiS02lvm2-monitorS15mdmonitorS26acpidS90crond
K16ksmK35smbK69rpcsvcgssdK84wpa_supplicantK89iscsid S08ip6tablesS22messagebusS26udev-postS99alsasound
这个级别启动的服务多了,NetworkManager/iptables/acpid/alsa都已经开启,但是nfs,smb,openvpn相关服务没有开启,这个级别不支持nfs。
init 3 , 对应的系统运行/etc/rc.d/rc3.d
[[email protected] ~] # ls
/etc/rc.d/rc3.d/
K01dnsmasqK30sendmailK74lm_sensorsK89rdiscS08iptablesS18rpcidmapdS25cupsS35qemuS85ksmtunedS99local
K10saslauthdK36mysqldK76openvpnK90network S12rsyslogS19rpcgssdS25netfsS50bluetoothS90crond
K10xfsK50netconsoleK84wpa_supplicantK99lvm2-monitorS13iscsiS22messagebusS26acpidS50haldaemonS91nmb
K20nfsK66gpsdK85mdmonitorS07iscsidS13rpcbindS23NetworkManagerS26udev-postS84ksmS91smb
K25sshdK69rpcsvcgssdK89netplugd S08ip6tablesS14nfslockS24portreserveS30vboxdrvS85gpmS99alsasound
这个级别nfs服务是开启的,被成为完全多用户模式。
init 4
[[email protected] ~ ]# ls
/etc/rc.d/rc4.d/
K01dnsmasqK30sendmailK66gpsdK85mdmonitorS07iscsidS13rpcbindS23NetworkManagerS26udev-postS84ksmS99local
K10saslauthdK35nmbK69rpcsvcgssdK89netplugd S08ip6tablesS14nfslockS24portreserveS30vboxdrvS85gpm
K10xfsK35smbK74lm_sensorsK89rdiscS08iptablesS18rpcidmapdS25cupsS35qemuS85ksmtuned
K20nfsK36mysqldK76openvpnK90network S12rsyslogS19rpcgssdS25netfsS50bluetoothS90crond
K25sshdK50netconsoleK84wpa_supplicantK99lvm2-monitorS13iscsiS22messagebusS26acpidS50haldaemonS99alsasound
此模式被称为安全模式。
init 5
[[email protected] ~ ]# ls
/etc/rc.d/rc5.d/
K01dnsmasqK25sshdK66gpsdK84wpa_supplicantK87rpcbindK90networkS22messagebusS26udev-postS84ksmS99local
K10saslauthdK30sendmailK69rpcsvcgssdK85mdmonitorK88iscsiK99lvm2-monitorS23NetworkManagerS30vboxdrvS85ksmtuned
K10xfsK36mysqldK74lm_sensorsK85rpcgssdK89iscsidS08ip6tablesS25cupsS35qemuS91nmb
K15gpmK50netconsoleK76openvpnK85rpcidmapdK89netplugdS08iptablesS25netfsS50bluetoothS91smb
K20nfsK60crondK83portreserveK86nfslockK89rdiscS12rsyslogS26acpidS50haldaemonS99alsasound
完整的图形模式
init 6
[[email protected] ~ ]# ls
/etc/rc.d/rc6.d/
K01dnsmasqK15ksmtunedK35nmbK60crondK74lm_sensorsK83portreserveK85rpcgssdK88iscsiK90networkS00killall
K10cupsK16ksmK35smbK66gpsdK75netfsK84NetworkManagerK85rpcidmapdK88rsyslogK92ip6tablesS01reboot
K10saslauthdK20nfsK36mysqldK69rpcsvcgssdK75udev-postK84wpa_supplicantK86nfslockK89iscsidK92iptables
K10xfsK25sshdK50haldaemonK70vboxdrvK76openvpnK85mdmonitorK87alsasoundK89netplugdK98qemu
K15gpmK30sendmailK50netconsoleK74acpidK83bluetoothK85messagebusK87rpcbindK89rdiscK99lvm2-monitor
这个级别里,只有两个服务,一个为killall,一个是reboot,即,关闭现在的系统,重启。故此级别是重启。
不同的系统版本,可能里面的文件会不同,如果要查看,可以通过ll来看,其实他们都是软连接。