CHKCONFIG(8)

๐Ÿ“ฆ version 1.33, in centos-stream 10, centos-stream 9, fedora 43, fedora 44

๐Ÿ’– CHKCONFIG(8) ๐Ÿ’–

okay bestie, welcome to the System Manager's Manual page for chkconfig, and no this is not a drill, this thing is literally the girlboss who runs your services at boot. let's get into it ๐ŸŽ€


โœจ NAME โœจ

chkconfig โ€” updates and queries runlevel information for system services ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

chkconfig [--list] [--type type] [name]
chkconfig --add name
chkconfig --del name
chkconfig --override name
chkconfig [--level levels] [--type type] [--no-redirect] name
<on|off|reset|resetpriorities>
chkconfig [--level levels] [--type type] [--no-redirect] name

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so chkconfig is your lil' bestie command-line tool for maintaining the /etc/rc[0-6].d directory hierarchy. it exists so that system admins never, ever have to sit there directly messing with the numerous symbolic links in those directories. we do not do that anymore. periodt. ๐Ÿ™…โ€โ™€๏ธ

ngl, this implementation of chkconfig was inspired by the chkconfig command that lives in the IRIX operating system. BUT โ€” and this is the plot twist โ€” instead of keeping configuration info outside the /etc/rc[0-6].d hierarchy, this version goes straight in and manages the symlinks in /etc/rc[0-6].d directly. which means all the config info about what services init starts lives in one single location. iconic, honestly. โœจ

chkconfig has five distinct functions, and yes she does all of them:

  • adding new services for management
  • removing services from management
  • listing the current startup information for services
  • changing the startup information for services
  • checking the startup state of a particular service

when you run chkconfig with only a service name, it checks whether that service is configured to be started in the current runlevel. if it is, chkconfig returns true. if it isn't, it returns false. simple as. the --level option lets you make it query a different runlevel instead of the current one.

when you run chkconfig with the --list argument โ€” or with no arguments at all โ€” you get a listing of all the services and their current configuration. a whole little lineup. ๐Ÿซถ

if one of on, off, reset, or resetpriorities shows up after the service name, chkconfig changes the startup information for that service. here's the tea:

  • on and off cause the service to be started or stopped, respectively, in the runlevels being changed.
  • reset resets the on/off state for all runlevels for the service to whatever is specified in the init script in question.
  • resetpriorities resets the start/stop priorities for the service to whatever is specified in the init script.

by default, the on and off options only affect runlevels 2, 3, 4, and 5, while reset and resetpriorities affect all of the runlevels. the --level option is how you say which runlevels are the ones getting touched.

note that for every service, each runlevel has either a start script or a stop script. when switching runlevels, init will not re-start an already-started service, and will not re-stop a service that is not running. she's efficient like that ๐Ÿ’…

chkconfig can also manage xinetd scripts via xinetd.d configuration files. but listen โ€” only the on, off, and --list commands are supported for xinetd.d services. that's the limit, bestie.

also, chkconfig supports a --type argument to limit actions to only a specific type of services, for those situations where services of either type might share a name. the possible values for type are sysv and xinetd. ๐Ÿงš


๐Ÿ’… OPTIONS ๐Ÿ’…

  • --level levels โ€” Specifies the run levels an operation should pertain to. it's given as a string of numbers from 0 to 6. for example, --level 35 specifies runlevels 3 and 5. easy peasy.
  • --no-redirect โ€” when chkconfig is run on a system that uses systemd as its init system, chkconfig will forward commands to systemd if a systemd service file exists for it. this switch turns off the redirection to systemd and only operates on the symlinks in /etc/rc[0-6].d. this option is only valid 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 service has either a start or a kill entry in every runlevel. if any runlevel is missing such an entry, chkconfig creates the appropriate entry as specified by the default values in the init script. note that default entries in LSB-delimited 'INIT INFO' sections take precedence over the default runlevels in the initscript; if any Required-Start or Required-Stop entries are present, the start and stop priorities of the script will be adjusted to account for these dependencies. ๐Ÿ”ฅ
  • --del name โ€” the service is removed from chkconfig management, and any symbolic links in /etc/rc[0-6].d which pertain to it are removed.
note that future package installs for this service may run chkconfig --add, which will re-add such links. to disable a service, run chkconfig name off. (different thing! don't get it twisted ๐Ÿ˜ญ)
  • --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 now exists and is specified differently from the base initscript, change the configuration for service name to follow the overrides instead of the base configuration. glow-up via config file โœจ
  • --list name โ€” this option lists all of the services which chkconfig knows about, and whether they are stopped or started in each runlevel. if name is specified, information is displayed about service name only. ๐Ÿ‘‘

๐ŸŽ€ RUNLEVEL FILES ๐ŸŽ€

every service that should be manageable by chkconfig needs two or more commented lines added to its init.d script.

  • the first line tells chkconfig what runlevels the service should be started in by default, plus the start and stop priority levels. if the service should not, by default, be started in any runlevels, a - should be used in place of the runlevels list.
  • the second line contains a description for the service, and it may be extended across multiple 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.

so this says the random script should be started in levels 2, 3, 4, and 5, that its start priority should be 20, and that its stop priority should be 80. you should be able to figure out what the description says; the \ causes the line to be continued. the extra space in front of the line is ignored. ๐Ÿ“

chkconfig also supports LSB-style init stanzas, and will apply them in preference to "chkconfig:" lines where available. an 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 such that it is higher than the "bar" start priority, if "bar" is enabled.

care must be taken when adding dependencies, as they can cause vast shifts in the start and stop priorities of many scripts. like, a domino effect, fr fr ๐Ÿ’€

๐ŸŒˆ OVERRIDE FILES ๐ŸŒˆ

files in /etc/chkconfig.d/servicename are parsed using the same comments that chkconfig notices in init service scripts, and they override values in the init service scripts themselves. main character energy, honestly. ๐Ÿ‘‘


โญ SEE ALSO โญ

init(8) ntsysv(8) system-config-services(8)


๐Ÿ’œ AUTHOR ๐Ÿ’œ

Erik Troan <ewt@redhat.com>


and that's the whole page, bestie ๐Ÿซถ this was the 4th Berkeley Distribution version, dated Wed Oct 8 1997 โ€” yeah she's vintage, she's a classic, she ate and left no crumbs ๐Ÿ’–โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from