自己最近刚刚开始写博客,所以为了树立自己的信心,就先从最简单的开始。
对于这个知识点,自己以前一直不了解,今天特意总结下,作为自己的一个学习记录
一. init是Linux系统操作中不可缺少的程序之一。
所谓的init进程,它是一个由内核启动的用户级进程。
内核自行启动(已经被载入内存,开始运行,并已初始化所有的设备驱动程序和数据结构等)之后,就通过启动一个用户级程序init的方式,完成引导进程。所以,init始终是第一个进程(其进程编号始终为1)。
内核会在过去曾使用过init的几个地方查找它,它的正确位置(对Linux系统来说)是/sbin/init。如果内核找不到init,它就会试着运行/bin/sh,如果运行失败,系统的启动也会失败。
二. init一共分为7个级别,这7个级别的所代表的含义如下
0:停机或者关机(千万不能将initdefault设置为0)
1:单用户模式,只root用户进行维护
2:多用户模式,不能使用NFS(Net File System)
3:完全多用户模式(标准的运行级别)
4:安全模式
5:图形化(即图形界面)
6:重启(千万不要把initdefault设置为6)
[root@localhost ~]# ls /etc/rc.d/rc0.d
K01dnsmasq K15ksmtuned K35nmb K60crond K74lm_sensors K83portreserve K85rpcgssd K88iscsi K90network S00killall
K10cups K16ksm K35smb K66gpsd K75netfs K84NetworkManager K85rpcidmapd K88rsyslog K92ip6tables S01halt
K10saslauthd K20nfs K36mysqld K69rpcsvcgssd K75udev-post K84wpa_supplicant K86nfslock K89iscsid K92iptables
K10xfs K25sshd K50haldaemon K70vboxdrv K76open K85mdmonitor K87alsasound K89netplugd K98qemu
K15gpm K30sendmail K50netconsole K74acpid K83bluetooth K85messagebus K87rpcbind K89rdisc K99lvm2-monitor
[root@localhost ~] # ls /etc/rc.d/rc1.d
K01dnsmasq K15ksmtuned K35nmb K60crond K74lm_sensors K84NetworkManager K85rpcidmapd K88rsyslog K92ip6tables S99single
K10cups K16ksm K35smb K66gpsd K75netfs K84wpa_supplicant K86nfslock K89iscsid K92iptables
K10saslauthd K20nfs K36mysqld K69rpcsvcgssd K76open K85mdmonitor K87alsasound K89netplugd K98qemu
K10xfs K25sshd K50haldaemon K70vboxdrv K83bluetooth K85messagebus K87rpcbind K89rdisc S02lvm2-monitor
K15gpm K30sendmail K50netconsole K74acpid K83portreserve K85rpcgssd K88iscsi K90network S26udev-post
init 2,对应的系统会运行,/etc/rc.d/rc2.d里指定的程序。
[root@localhost ~ ]# ls /etc/rc.d/rc2.d/
K01dnsmasq K20nfs K36mysqld K74lm_sensors K85rpcgssd K89netplugd S08iptables S23NetworkManager S30vboxdrv S99local
K10saslauthd K25sshd K50haldaemon K75netfs K85rpcidmapd K89rdisc S12rsyslog S24portreserve S35qemu
K10xfs K30sendmail K50netconsole K76open K86nfslock K90network S13rpcbind S25cups S85gpm
K15ksmtuned K35nmb K66gpsd K83bluetooth K88iscsi S02lvm2-monitor S15mdmonitor S26acpid S90crond
K16ksm K35smb K69rpcsvcgssd K84wpa_supplicant K89iscsid S08ip6tables S22messagebus S26udev-post S99alsasound
init 3 , 对应的系统运行/etc/rc.d/rc3.d
[root@localhost ~] # ls /etc/rc.d/rc3.d/
K01dnsmasq K30sendmail K74lm_sensors K89rdisc S08iptables S18rpcidmapd S25cups S35qemu S85ksmtuned S99local
K10saslauthd K36mysqld K76open K90network S12rsyslog S19rpcgssd S25netfs S50bluetooth S90crond
K10xfs K50netconsole K84wpa_supplicant K99lvm2-monitor S13iscsi S22messagebus S26acpid S50haldaemon S91nmb
K20nfs K66gpsd K85mdmonitor S07iscsid S13rpcbind S23NetworkManager S26udev-post S84ksm S91smb
K25sshd K69rpcsvcgssd K89netplugd S08ip6tables S14nfslock S24portreserve S30vboxdrv S85gpm S99alsasound
init 4
[root@localhost ~ ]# ls /etc/rc.d/rc4.d/
K01dnsmasq K30sendmail K66gpsd K85mdmonitor S07iscsid S13rpcbind S23NetworkManager S26udev-post S84ksm S99local
K10saslauthd K35nmb K69rpcsvcgssd K89netplugd S08ip6tables S14nfslock S24portreserve S30vboxdrv S85gpm
K10xfs K35smb K74lm_sensors K89rdisc S08iptables S18rpcidmapd S25cups S35qemu S85ksmtuned
K20nfs K36mysqld K76open K90network S12rsyslog S19rpcgssd S25netfs S50bluetooth S90crond
K25sshd K50netconsole K84wpa_supplicant K99lvm2-monitor S13iscsi S22messagebus S26acpid S50haldaemon S99alsasound
init 5
[root@localhost ~ ]# ls /etc/rc.d/rc5.d/
K01dnsmasq K25sshd K66gpsd K84wpa_supplicant K87rpcbind K90network S22messagebus S26udev-post S84ksm S99local
K10saslauthd K30sendmail K69rpcsvcgssd K85mdmonitor K88iscsi K99lvm2-monitor S23NetworkManager S30vboxdrv S85ksmtuned
K10xfs K36mysqld K74lm_sensors K85rpcgssd K89iscsid S08ip6tables S25cups S35qemu S91nmb
K15gpm K50netconsole K76open K85rpcidmapd K89netplugd S08iptables S25netfs S50bluetooth S91smb
K20nfs K60crond K83portreserve K86nfslock K89rdisc S12rsyslog S26acpid S50haldaemon S99alsasound
init 6
[root@localhost ~ ]# ls /etc/rc.d/rc6.d/
K01dnsmasq K15ksmtuned K35nmb K60crond K74lm_sensors K83portreserve K85rpcgssd K88iscsi K90network S00killall
K10cups K16ksm K35smb K66gpsd K75netfs K84NetworkManager K85rpcidmapd K88rsyslog K92ip6tables S01reboot
K10saslauthd K20nfs K36mysqld K69rpcsvcgssd K75udev-post K84wpa_supplicant K86nfslock K89iscsid K92iptables
K10xfs K25sshd K50haldaemon K70vboxdrv K76open K85mdmonitor K87alsasound K89netplugd K98qemu
K15gpm K30sendmail K50netconsole K74acpid K83bluetooth K85messagebus K87rpcbind K89rdisc K99lvm2-monitor