linux下chkconfig命令的使用

上一篇 / 下一篇  2009-02-25 09:07:45 / 个人分类:linux

chkconfig 有五项功能:添加服务,删除服务,列表服务,
改变启动信息以及检查特定服务的启动状态

使用语法
usage:  chkconfig --list [name]
    chkconfig --add <name>
    chkconfig --del <name>
    chkconfig [--level <levels>] <name> <on|off|reset>

chkconfig --list 列出当前服务在各个run leves的设定状态。

# chkconfig --list
NetworkManager  0:off   1:off   2:off   3:off   4:off   5:off   6:off
NetworkManagerDispatcher        0:off   1:off   2:off   3:off   4:off   5:off   6:off
acpid           0:off   1:off   2:off   3:on    4:on    5:on    6:off
anacron         0:off   1:off   2:on    3:on    4:on    5:on    6:off
apmd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
atd             0:off   1:off   2:off   3:on    4:on    5:on    6:off
auditd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
......


如果想要启动httpd服务,首先查看httpd的状态。

chkconfig --list httpd

# chkconfig --list httpd
httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off


# chkconfig httpd off 关闭服务
# chkconfig httpd on  开启服务
也可以选择 level 开启服务
# chkconfig --level 345 httpd on

# chkconfig --level 345 httpd on
httpd           0:off   1:off   2:off   3:on    4:on    5:on    6:off

 

chkconfig 查看帮助
# man chkconfig

在/etc/init.d目录下,任意打开一个启动脚本,你会发现在其顶部的注释中,基本上都有以下一行:

chkconfig 235 56 34(也可能是其他数字组合)

就以chkconfig 235 56 34为例,235表示该启动脚本对应的服务将在系统启动级别2, 3, 5级启动。而56表示其启动优先级为56,所谓的优先级,就是在rc脚本中出现在各个符号链接名中的数字。而34就是终止优先级。


TAG: chkconfig Linux linux

 

评分:0

我来说两句

Open Toolbar