【Linux】一步一步学Linux——chkconfig命令(148)
00. 目錄
文章目錄
- 00. 目錄
- 01. 命令概述
- 02. 命令格式
- 03. 常用選項
- 04. 參考示例
- 05. 總結(jié)
- 06. 附錄
01. 命令概述
chkconfig命令檢查、設(shè)置系統(tǒng)的各種服務(wù)。這是Red Hat公司遵循GPL規(guī)則所開發(fā)的程序,它可查詢操作系統(tǒng)在每一個執(zhí)行等級中會執(zhí)行哪些系統(tǒng)服務(wù),其中包括各類常駐服務(wù)。謹(jǐn)記chkconfig不是立即自動禁止或激活一個服務(wù),它只是簡單的改變了符號連接。
02. 命令格式
用法:chkconfig [--list] [--type <type>] [name]chkconfig --add <name>chkconfig --del <name>chkconfig --override <name>chkconfig [--level <levels>] [--type <type>] <name> <on|off|reset|resetpriorities>03. 常用選項
必要參數(shù)--add 開啟指定的服務(wù)程序--del 關(guān)閉指定的服務(wù)程序--list 列出chkconfig所知道的所有服務(wù)選擇參數(shù)--level<代號> 設(shè)置服務(wù)程序的等級代號,它是一串0~7的數(shù)字,如“-level35”代表指定運(yùn)行等級3和5--help 顯示幫助信息--version 顯示版本信息等級代號說明:
- 等級0表示:表示關(guān)機(jī)
- 等級1表示:單用戶模式
- 等級2表示:無網(wǎng)絡(luò)連接的多用戶命令行模式
- 等級3表示:有網(wǎng)絡(luò)連接的多用戶命令行模式
- 等級4表示:不可用
- 等級5表示:帶圖形界面的多用戶模式
- 等級6表示:重新啟動
04. 參考示例
4.1 列出所有的系統(tǒng)服務(wù)
[deng@localhost ~]$ chkconfig --list注:該輸出結(jié)果只顯示 SysV 服務(wù),并不包含 原生 systemd 服務(wù)。SysV 配置數(shù)據(jù) 可能被原生 systemd 配置覆蓋。 要列出 systemd 服務(wù),請執(zhí)行 'systemctl list-unit-files'。查看在具體 target 啟用的服務(wù)請執(zhí)行'systemctl list-dependencies [target]'。netconsole 0:關(guān) 1:關(guān) 2:關(guān) 3:關(guān) 4:關(guān) 5:關(guān) 6:關(guān) network 0:關(guān) 1:關(guān) 2:開 3:開 4:開 5:開 6:關(guān) vmware-tools 0:關(guān) 1:關(guān) 2:開 3:開 4:開 5:開 6:關(guān) vmware-tools-thinprint 0:關(guān) 1:關(guān) 2:開 3:開 4:開 5:開 6:關(guān) [deng@localhost ~]$4.2 增加network服務(wù)
[root@localhost ~]# chkconfig --add network–add 增加所指定的系統(tǒng)服務(wù),讓chkconfig指令得以管理它,并同時在系統(tǒng)啟動的敘述文件內(nèi)增加相關(guān)數(shù)據(jù)
4.3 刪除network服務(wù)
[root@localhost ~]# chkconfig --del network–del 刪除所指定的系統(tǒng)服務(wù),不再由chkconfig指令管理,并同時在系統(tǒng)啟動的敘述文件內(nèi)刪除相關(guān)數(shù)據(jù)
4.4 設(shè)置network在運(yùn)行級別為2、3、4、5的情況下都是on(開啟)的狀態(tài)
[root@localhost ~]# chkconfig --level 2345 network on4.5 設(shè)置network在運(yùn)行級別為2、3、4、5的情況下都是off(關(guān)閉)的狀態(tài)
[root@localhost ~]# chkconfig --level 2345 network off4.6 查看network服務(wù)狀態(tài)
[root@localhost ~]# chkconfig --list network注:該輸出結(jié)果只顯示 SysV 服務(wù),并不包含 原生 systemd 服務(wù)。SysV 配置數(shù)據(jù) 可能被原生 systemd 配置覆蓋。 要列出 systemd 服務(wù),請執(zhí)行 'systemctl list-unit-files'。查看在具體 target 啟用的服務(wù)請執(zhí)行'systemctl list-dependencies [target]'。network 0:關(guān) 1:關(guān) 2:開 3:開 4:開 5:開 6:關(guān) [root@localhost ~]#4.7 設(shè)置network在運(yùn)行級別為2、3、4、5的情況下都是on(開啟)的狀態(tài)
[root@localhost ~]# chkconfig network on [root@localhost ~]# chkconfig --list注:該輸出結(jié)果只顯示 SysV 服務(wù),并不包含 原生 systemd 服務(wù)。SysV 配置數(shù)據(jù) 可能被原生 systemd 配置覆蓋。 要列出 systemd 服務(wù),請執(zhí)行 'systemctl list-unit-files'。查看在具體 target 啟用的服務(wù)請執(zhí)行'systemctl list-dependencies [target]'。netconsole 0:關(guān) 1:關(guān) 2:關(guān) 3:關(guān) 4:關(guān) 5:關(guān) 6:關(guān) network 0:關(guān) 1:關(guān) 2:開 3:開 4:開 5:開 6:關(guān) vmware-tools 0:關(guān) 1:關(guān) 2:開 3:開 4:開 5:開 6:關(guān) vmware-tools-thinprint 0:關(guān) 1:關(guān) 2:開 3:開 4:開 5:開 6:關(guān) [root@localhost ~]#4.8 設(shè)置network在運(yùn)行級別為2、3、4、5的情況下都是off(關(guān)閉)的狀態(tài)
[root@localhost ~]# chkconfig network off [root@localhost ~]# chkconfig --list network注:該輸出結(jié)果只顯示 SysV 服務(wù),并不包含 原生 systemd 服務(wù)。SysV 配置數(shù)據(jù) 可能被原生 systemd 配置覆蓋。 要列出 systemd 服務(wù),請執(zhí)行 'systemctl list-unit-files'。查看在具體 target 啟用的服務(wù)請執(zhí)行'systemctl list-dependencies [target]'。network 0:關(guān) 1:關(guān) 2:關(guān) 3:關(guān) 4:關(guān) 5:關(guān) 6:關(guān) [root@localhost ~]#05. 總結(jié)
06. 附錄
參考:【Linux】一步一步學(xué)Linux系列教程匯總
總結(jié)
以上是生活随笔為你收集整理的【Linux】一步一步学Linux——chkconfig命令(148)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Linux】一步一步学Linux——s
- 下一篇: 【Linux】一步一步学Linux——n