chkconfig 實現在相應系統級別開啓或關閉服務的原理?

[root@mfsclient ~]# chkconfig --level 3 nfs on #讓NFS在字符界面開啓
[root@mfsclient ~]# ll /etc/rc.d/rc3.d/ | grep nfs
lrwxrwxrwx 1 root root 17 Mar 16 2013 K86nfslock -> ../init.d/nfslock
lrwxrwxrwx 1 root root 13 Oct 22 21:46 S60nfs -> ../init.d/nfs #其實是把nfs命令鏈接到rc3.d下,並以S開頭,代表啓動!數字則是代表啓動順序
[root@mfsclient ~]# chkconfig --level 3 nfs off
[root@mfsclient ~]# ll /etc/rc.d/rc3.d/ | grep nfs
lrwxrwxrwx 1 root root 13 Oct 22 21:47 K20nfs -> ../init.d/nfs #在某個運行級別停止,則是以K開頭
lrwxrwxrwx 1 root root 17 Mar 16 2013 K86nfslock -> ../init.d/nfslock

運行級別說明:

# 0 - halt (Do NOT set initdefault to this) 開機
# 1 - Single user mode 單用戶模式
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking) #不帶網絡的字符界面
# 3 - Full multiuser mode #字符界面
# 4 - unused #保留
# 5 - X11 #圖形界面
# 6 - reboot (Do NOT set initdefault to this) 重啓


系統腳本示例:

[root@mfsclient ~]# cat /etc/init.d/nfs
#!/bin/sh
#
# nfs This shell script takes care of starting and stopping
# the NFS services.
#
# chkconfig: - 60 20 #-表標在所有的運行級別;60表示啓動序號;20表示關閉序號


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章