linux chkconfig command example

Posted on November 15, 2012

Linux command chkconfig is used to updates and queries runlevel information for system services.
SYNOPSIS

chkconfig –list [name]
chkconfig –add name
chkconfig –del name
chkconfig [--level levels] name <on|off|reset>
chkconfig [--level levels] name

EXAMPLES:

1.Example to list all the serviced that chkconfig knows

chkconfig –list

2.Example to list a specified service’s status ,below command list the status of service

bash-3.2$ chkconfig –list xinetd[root@server001 ~]# chkconfig –list mysqld
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off

3.Example to enable a specified service,below command just enable service mysqld

[root@server001 ~]# chkconfig mysqld on
[root@server001 ~]# chkconfig –list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@server001 ~]#

4.Example to enable a service on at specified levels,below command enable mysqld on level 3 and 5

[root@server001 ~]# chkconfig –list mysqld
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@server001 ~]# chkconfig –level 35 mysqld on
[root@server001 ~]# chkconfig –list mysqld
mysqld 0:off 1:off 2:off 3:on 4:off 5:on 6:off
[root@server001 ~]#

5.To delete a service from chkconfig management

chconfig –del service

6.To add a service for management by chkconfig(Make sure your service’s script locates under /etc/init.d)

chkconfig –add service

 

Note:About linux run levels

0: shutdown

1:single mode

2:multiple user mode without network

3.multiple user mode with network

4.Non-used,reserved for future

5.multiple user mode with network and gui mode

6.Reboot

» Filed Under Linux

Comments

Leave a Reply