Saturday, June 6, 2009

The CHKCONFIG Command

This is just a basic outline of the usage and function of the linux command-line command of CHKCONFIG.

This command-line tool and be use in five different modes:
  1. Adding new services
  2. Removing services
  3. Reporting on current services
  4. Turning services on and off
  5. Reporting on service status
One of the more useful ways to use this command is to report on a specific service.

Basics
For example:
Note: these commands are best run as either root or using sudo.
#chkconfig --list httpd
This command will list init run levels that this service is set to run in.
This is the output from that command (example only).
[root@server ~]# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
To delete a service from all init run levels, use the following:
#chkconfig --del
*Where , insert the name of the service you wish to delete.

To add a new service:
#chkconfig --add

Advanced
For a more detailed approach when adding services, you can specify which run levels the new service will be configure to. For example:
#chkconfig --level 35 on
This will result in your specified service only running in run levels 3 and 5.
#chkconfig --level 01246 off
This will result in your specified service not running in run levels 0, 1, 2, 4 & 6. Leaving the service to run in 3 and 5.

Links
More information can be found at the following links.

http://linuxcommand.org/man_pages/chkconfig8.html

http://en.wikipedia.org/wiki/Runlevel

http://oreilly.com/linux/command-directory/cmd.csp?path=c/chkconfig

No comments:

Post a Comment