歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> Linux中chkconfig命令打開或關閉系統服務的使用教程

Linux中chkconfig命令打開或關閉系統服務的使用教程

日期:2017/3/1 17:29:32   编辑:Linux技術

chkconfig提供了一個維護/etc/rc[0~6] d 文件夾的命令行工具,它減輕了系統直接管理這些文件夾中的符號連接的負擔。chkconfig主要包括5個原始功能:為系統管理增加新的服務、為系統管理移除服務、列出單簽服務的啟動信息、改變服務的啟動信息和檢查特殊服務的啟動狀態。當單獨運行chkconfig命令而不加任何參數時,他將顯示服務的使用信息。

必要參數
--add 開啟指定的服務程序
--del 關閉指定的服務程序
--list 列出chkconfig所知道的所有服務

選擇參數
--level<代號> 設置服務程序的等級代號,它是一串0~7的數字,如“-level35”代表指定運行等級3和5
--help 顯示幫助信息
--version 顯示版本信息

用法1

復制代碼代碼如下:
[root@localhost www]# chkconfig --list #查看系統程序列表
[root@localhost www]# chkconfig httpd on #將httpd加入開機啟動
[root@localhost www]# chkconfig httpd off #關閉httpd開機啟動

用法2

復制代碼代碼如下:
[root@localhost tank]# chkconfig --add nginx #添加nginx啟動腳本為chkconfig管理的一個服務
[root@localhost tank]# chkconfig --del nginx #刪除chkconfig管理的的nginx啟動服務

實例:
安裝cent os 64位 後,默認帶了很不多不必要的服務,用以下命令列出:

復制代碼代碼如下:
chkconfig --list | grep :on

cups 打印服務 yum-updatesd 常在繁忙的時候占用大量CPU和內存 pcscd 智能卡,比如SD讀卡器 hidd 和 bluetooth 藍牙 cpuspeed 智能調節CPU,筆記本用 firstboot 第一次安裝完成後的引導設置 gpm 鼠標復制粘貼

復制代碼代碼如下:
chkconfig cups off
chkconfig yum-updatesd off
chkconfig pcscd off
chkconfig hidd off
chkconfig bluetooth off
chkconfig cpuspeed off
chkconfig firstboot off
chkconfig gpm off

以下的內容來源於網絡,未考證功用

復制代碼代碼如下:
chkconfig rhnsd off
chkconfig anacron off
chkconfig arptables_jf off
chkconfig autofs off
chkconfig openibd off
chkconfig messagebus off
chkconfig rawdevices off
chkconfig canna off
chkconfig atd off
chkconfig iiim off
chkconfig pcmcia off
chkconfig haldaemon off
chkconfig iptables off
chkconfig mdmonitor off
chkconfig hpoj off
#chkconfig nfslock off
chkconfig acpid off
chkconfig sendmail off
chkconfig cups off
chkconfig isdn off
chkconfig irqbalance off
chkconfig microcode_ctl off
chkconfig cups-config-daemon off
chkconfig ip6tables off

其他: 關閉nfs相關服務 關閉rpc相關服務
關閉
復制代碼代碼如下: SELinux vi /etc/selinux/config

Copyright © Linux教程網 All Rights Reserved