MAN page from CentOS 7 chkconfig-1.7.4-1.el7.i686.rpm
Section: Maintenance Commands (8)
Updated: Wed Oct 8 1997Index
chkconfig - updates and queries runlevel information for system services
] [--type type
]chkconfig --add namechkconfig --del namechkconfig --override namechkconfig
] [--type type
] [--type type
provides a simple command-line tool for maintaining the/etc/rc[0-6].d directory hierarchy by relieving system administrators ofthe task of directly manipulating the numerous symbolic links in thosedirectories.
This implementation of chkconfig was inspired by the chkconfigcommand present in the IRIX operating system. Rather than maintaining configuration information outside of the /etc/rc[0-6].d hierarchy, however,this version directly manages the symlinks in /etc/rc[0-6].d. This leaves allof the configuration information regarding what services initstarts in a single location.
chkconfig has five distinct functions: adding new services formanagement, removing services from management, listing the currentstartup information for services, changing the startup informationfor services, and checking the startup state of a particular service.
When chkconfig is run with only a service name, it checks to see ifthe service is configured to be started in the current runlevel. Ifit is, chkconfig returns true; otherwise it returns false. The--level option may be used to have chkconfig query analternative runlevel rather than the current one.
When chkconfig is run with the --list argument, or noarguments at all, a listing is displayed of all services and theircurrent configuration.
If one of on, off, reset, or resetpriorities isspecified after the service name, chkconfig changes the startupinformation for the specified service. The on and off flagscause the service to be started or stopped, respectively, in the runlevelsbeing changed. The reset flag resets the on/off state for allrunlevels for the service to whatever is specified in the init script in question,while the resetpriorities flag resets the start/stop prioritiesfor the service to whatever is specified in the init script.
By default, the on and off options affect only runlevels 2, 3, 4,and 5, while reset and resetpriorities affects all of the runlevels.The --level option may be used to specify which runlevels are affected.
Note that for every service, each runlevel has either a start scriptor a stop script. When switching runlevels, init will not re-startan already-started service, and will not re-stop a service that isnot running.
chkconfig also can manage xinetd scripts via the meansof xinetd.d configuration files. Note that only theon, off, and --list commands are supportedfor xinetd.d services.
chkconfig supports a --type argument to limit actions to onlya specific type of services, in the case where services of either type mayshare a name. Possible values for type are sysvand xinetd.
- --level levels
- Specifies the run levels an operation should pertain to. It is given asa string of numbers from 0 to 6. For example, --level 35 specifiesrunlevels 3 and 5.
- When chkconfig is run on a system that uses systemd as its init system,chkconfig will forward commands to systemd if a systemd servicefile exists for it. This switch turns off the redirection to systemd andonly operates on the symlinks in /etc/rc[0-6].d. This option is onlyvalid when on, off, or no command (to check enablement)is passed to a service.
- --add name
This option adds a new service for management by chkconfig.When a new service is added, chkconfig ensures that the servicehas either a start or a kill entry in every runlevel. If any runlevelis missing such an entry, chkconfig creates the appropriate entryas specified by the default values in the init script. Note thatdefault entries in LSB-delimited 'INIT INFO' sections take precedenceover the default runlevels in the initscript; if any Required-Start orRequired-Stop entries are present, the start and stop priorities of thescript will be adjusted to account for these dependencies.
- --del name
- The service is removed from chkconfig management, and any symboliclinks in /etc/rc[0-6].d which pertain to it are removed.
Note that future package installs for this service may runchkconfig --add, which will re-add such links. To disable aservice, run chkconfig name off.
- --override name
- If service name is configured exactly as it would be if the--add option had been specified with no override file in/etc/chkconfig.d/name, and if /etc/chkconfig.d/name nowexists and is specified differently from the base initscript,change the configuration for service name to follow theoverrides instead of the base configuration.
- --list name
- This option lists all of the services which chkconfig knows about,and whether they are stopped or started in each runlevel. If nameis specified, information in only display about service name.
Each service which should be manageable by chkconfig needs twoor more commented lines added to its init.d script. The first linetells chkconfig what runlevels the service should be started inby default, as well as the start and stop priority levels. If the serviceshould not, by default, be started in any runlevels, a - should beused in place of the runlevels list. The secondline contains a description for the service, and may be extended acrossmultiple lines with backslash continuation.
For example, random.init has these three lines:
# chkconfig: 2345 20 80# description: Saves and restores system entropy pool for \# higher quality random number generation.
This says that the random script should be started in levels 2, 3, 4,and 5, that its start priority should be 20, and that its stoppriority should be 80. You should be able to figure out what thedescription says; the \ causes the line to be continued. Theextra space in front of the line is ignored.
chkconfig also supports LSB-style init stanzas, and will applythem in preference to "chkconfig:" lines where available.A LSB stanza looks like:
### BEGIN INIT INFO# Provides: foo# Required-Start: bar# Defalt-Start: 2 3 4 5# Default-Stop: 0 1 6# Description: Foo init script### END INIT INFO
In this case, the start priority of "foo" would be changed suchthat it is higher than the "bar" start priority, if "bar" is enabled.Care must be taken when adding dependencies, as they can causevast shifts in the start and stop priorities of many scripts.
Files in /etc/chkconfig.d/servicename are parsed using thesame comments that chkconfig notices in init service scripts,and override values in the init service scripts themselves.
Erik Troan <ewtAATTredhat.com>
- RUNLEVEL FILES
- OVERRIDE FILES
- SEE ALSO
This document was created byman2html,using the manual pages.