[root@deyu ~]# chkconfig --help chkconfig version 1.3.47 - Copyright (C) 1997-2000 Red Hat, Inc. This may be freely redistributed under the terms of the GNU Public License. usage: chkconfig [--list] [--type <type>] [name] chkconfig --add <name> chkconfig --del <name> chkconfig --override <name> chkconfig [--level <levels>] [--type <type>] <name> <on|off|reset|resetpriorities>
[root@deyu ~]# chkconfig --list httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off iptables 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 xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off ypbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off xinetd based services: rsync: off tftp: on
[root@deyu ~]# chkconfig --list httpd httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@deyu ~]# chkconfig httpd on [root@deyu ~]# chkconfig --list httpd httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@deyu ~]# chkconfig --level 2 httpd off [root@deyu ~]# chkconfig --list httpd httpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
[root@deyu ~]# vi /etc/init.d/myservice #!/bin/bash echo "chkconfig test" [root@deyu ~]# chkconfig --add myservice service myservice does not support chkconfig
[root@deyu ~]# vi /etc/init.d/myservice #!/bin/bash # chkconfig: 35 91 81 <= 注意以下測試 # description: only for test echo "chkconfig test" [root@deyu ~]# chkconfig --add myservice [root@deyu ~]# chkconfig --list myservice myservice 0:off 1:off 2:off 3:on 4:off 5:on 6:off # run level 3及5啟動;/etc/rc.d/rc[35].d 當中啟動時,以91順位啟動,以81順位結束。 [root@deyu ~]# ll /etc/rc.d/rc[35].d/*myservice* lrwxrwxrwx. 1 root root 19 Dec 26 09:28 /etc/rc.d/rc3.d/S91myservice -> ../init.d/myservice lrwxrwxrwx. 1 root root 19 Dec 26 09:28 /etc/rc.d/rc5.d/S91myservice -> ../init.d/myservice # run level 1關閉;/etc/rc.d/rc1.d 當中以81順位結束。 [root@deyu ~]# ll /etc/rc.d/rc1.d/*myservice* lrwxrwxrwx. 1 root root 19 Dec 26 09:28 /etc/rc.d/rc1.d/K81myservice -> ../init.d/myservice
[root@deyu ~]# chkconfig myservice off [root@deyu ~]# chkconfig --list myservice myservice 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@deyu ~]# chkconfig --del myservice [root@deyu ~]# chkconfig --list myservice service myservice supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add myservice') [root@deyu ~]# rm -f /etc/init.d/myservice [root@deyu ~]# chkconfig --list myservice error reading information on service myservice: No such file or directory
2015-04-13