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