说明 |
并没有列出所有的选项,只是列出常用的选项。如果以后有用到没有记录的选项,会对该博客进行更新和维护。 |
联系方式 |
QQ:1369929127 Email:[email protected] |
chkconfig更新和查询系统服务的运行级别信息
开机自启动项
chkconfig[--list] [--type type][name]
chkconfig--add name
chkconfig--del name
chkconfig--override name
chkconfig[--level levels] [--type type] name <on|off|reset|resetpriorities>
chkconfig[--level levels] [--type type] name
当前开机自启动项
[root@oldboy ~]# chkconfig --list | grep '3:on' crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off sysstat 0:off 1:on 2:on 3:on 4:on 5:on 6:off--list name 列出对应服务在每个运行级别启动或关闭信息
[root@oldboy ~]# chkconfig --list network network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@oldboy ~]# chkconfig --list abrt-ccpp 0:off 1:off 2:off 3:off 4:off 5:off 6:off abrtd 0:off 1:off 2:off 3:off 4:off 5:off 6:off acpid 0:off 1:off 2:off 3:off 4:off 5:off 6:off atd 0:off 1:off 2:off 3:off 4:off 5:off 6:off auditd 0:off 1:off 2:off 3:off 4:off 5:off 6:off blk-availability 0:off 1:on 2:off 3:off 4:off 5:off 6:off cpuspeed 0:off 1:on 2:off 3:off 4:off 5:off 6:off crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off ………………
[root@oldboy ~]# chkconfig --list sshd sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@oldboy ~]# chkconfig --list | grep '3:on' # 优化后的信息 crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off #定时任务 network 0:off 1:off 2:on 3:on 4:on 5:on 6:off #网络 rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off #日志 sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off #SSH远程连接 sysstat 0:off 1:on 2:on 3:on 4:on 5:on 6:off #性能监控检测
生产环境默认的运营级别都为3【命令行模式】
#chkconfig --list | awk '{print $1}' #chkconfig --list | awk '{print "chkconfig",$1,"on"}' # 使用空格分隔 如: chkconfig ntpd on #chkconfig --list | awk '{print "chkconfig",$1,"on"}' | bash # 将所有信息将给bash执行 #chkconfig –list ##或者: chkconfig --list | grep '3:on' # 所有的服务都已经开启
命令行命令如下: *:请依次操作
#chkconfig --list #chkconfig --list | awk '{print $1}' #chkconfig --list | awk '{print "chkconfig",$1,"off"}' #chkconfig --list | awk '{print "chkconfig",$1,"off"}' | bash #chkconfig --list | grep '3:on' # 没有任何信息 #chkconfig --list | grep -E 'crond|rsyslog|network|sshd|sysstat' #chkconfig --list | grep -E 'crond|rsyslog|network|sshd|sysstat' | awk '{print "chkconfig",$1,"on"}' #chkconfig --list | grep -E 'crond|rsyslog|network|sshd|sysstat' | awk '{print "chkconfig",$1,"on"}' | bash #chkconfig --list | grep '3:on'
#chkconfig --list #chkconfig --list | grep -Ev 'crond|network|rsyslog|sshd|sysstat' #chkconfig --list | grep -Ev 'crond|network|rsyslog|sshd|sysstat' | awk '{print "chkconfig",$1,"off"}' #chkconfig --list | grep -Ev 'crond|network|rsyslog|sshd|sysstat' | awk '{print "chkconfig",$1,"off"}' | bash #chkconfig --list | grep '3:on'
[root@oldboy ~]# chkconfig saslauthd off [root@oldboy ~]# chkconfig --list saslauthd saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@oldboy ~]# chkconfig --level 35 saslauthd on #运行级别3和5 [root@oldboy ~]# chkconfig --list saslauthd saslauthd 0:off 1:off 2:off 3:on 4:off 5:on 6:off [root@oldboy ~]# chkconfig saslauthd on # 级别2-5 [root@oldboy ~]# chkconfig --list saslauthd saslauthd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@oldboy ~]# which chkconfig /sbin/chkconfig [root@oldboy ~]# type chkconfig chkconfig is hashed (/sbin/chkconfig)
1、chkconfig命令详解
2、Linux下chkconfig命令详解
3、chkconfig命令