Skip to content

Instantly share code, notes, and snippets.

@jathanism
Created June 29, 2013 20:09
Show Gist options
  • Select an option

  • Save jathanism/5892485 to your computer and use it in GitHub Desktop.

Select an option

Save jathanism/5892485 to your computer and use it in GitHub Desktop.
Man page for the `chkconfig` bash script by Eric S. Raymond. | Author: Eric S. Raymond | Source: https://lists.ubuntu.com/archives/upstart-devel/2007-May/000415.html | Script code: https://gist.github.com/jathanism/5892482
.TH CHKCONFIG 8 "Wed Oct 8 1997"
.UC 4
.SH NAME
chkconfig \- updates and queries runlevel information for system services
.SH SYNOPSIS
\fBchkconfig\fR \fB--list\fR [\fIname\fR]
.br
\fBchkconfig\fR [\fB--dryrun\fR] \fB--add\fR \fIname\fR
.br
\fBchkconfig\fR [\fB--dryrun\fR] \fB--del\fR \fIname\fR
.br
\fBchkconfig\fR [\fB--dryrun\fR] [\fB--level\fR \fIlevels\fR]
\fIname\fR {\fBon\fR|\fBoff\fR||\fBreset\fR\fR} [priority]
.br
\fBchkconfig\fR [\fB--level\fR \fIlevels\fR] \fIname\fR
.br
.SH DESCRIPTION
\fBchkconfig\fR provides a simple command-line tool for maintaining the
/etc/rc[0-6].d directory hierarchy by relieving system administrators of
the task of directly manipulating the numerous symbolic links in those
directories.
This implementation of \fBchkconfig\fR was inspired by the
\fBchkconfig\fR command present in the IRIX operating system and Red
Hat Linux. Rather than maintaining configuration information outside
of the /etc/rc[0-6].d hierarchy, however, this version uses
update-rc.d to directly manages the symlinks in /etc/rc[0-6].d. This
leaves all of the configuration information regarding what services
\fIinit\fR starts in a single location.
\fBchkconfig\fR has five distinct functions: adding new services for
management, removing services from management, listing the current
startup information for services, changing the startup information
for services, and checking the startup state of a particular service.
When \fBchkconfig\fR is run without any options, it displays usage
information. If only a service name is given, it checks to see if the
service is configured to be started in the current runlevel. If it is,
\fBchkconfig\fR returns true (0); otherwise it returns false (1). The
\fB--level\fR option may be used to have \fBchkconfig\fR query an
alternative runlevel rather than the current one.
If one of \fBon\fR, \fBoff\fR, or \fRreset\fR is specified after the
service name, \fBchkconfig\fR changes the startup information for the
specified service. The \fBon\fR and \fBoff\fR flags cause the service
to be started or stopped, respectively, in the runlevels being changed.
The \fBreset\fR flag resets the startup information for the service to
whatever is specified in the init script in question.
The optional priority argument, used only if the operation is \fBon\fR
or\fBoff\fR, sets the start or stop priority of the link.
By default, the \fBon\fR and \fBoff\fR options affect only runlevels 2, 3, 4,
and 5, while \fBreset\fR affects all of the runlevels. The \fB--level\fR
option may be used to specify which runlevels are affected.
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.
.SH OPTIONS
.TP
\fB--dryrun\fR
Show what the rest of the command line would do, but don't actually do it.
.TP
\fB-\-level \fIlevels\fR
Specifies the run levels an operation should pertain to. It is given as
a string of numbers from 0 to 7. For example, \fB--level 35\fR specifies
runlevels 3 and 5.
.TP
\fB-\-add\fR \fIname\fR
This option adds a new service for management by \fBchkconfig\fR.
When a new service is added, \fBchkconfig\fR ensures that the service
has either a start or a kill entry in every runlevel. If any runlevel
is missing such an entry, \fBchkconfig\fR 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.
.TP
\fB-\-del\fR \fIname\fR
The service is removed from \fBchkconfig\fR 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
\fBchkconfig \-\-add\fR, which will re-add such links. To disable a
service, run \fBchkconfig \fIname\fR \fBoff\fR.
.TP
\fB-\-list\fR \fIname\fR
This option lists all of the services which \fBchkconfig\fR knows about,
and whether they are stopped or started in each runlevel. If \fIname\fR
is specified, information in only display about service \fIname\fR.
.SH LIMITATIONS
Red Hat \fBchkconfig\fR could manage xinetd scripts by manipulating
xinetd.d configuration files (only the \fBon\fR, \fBoff\fR, and
\fB-\-list\fR commands were supported for xinetd.d services). This
Debian/Ubuntu port doesn't do that.
Red Hat \fBchkconfig\fR had a special syntax for embedding
metainformation in init-script headers which this script doesn't
support. Instead, this script interprets LSB INIT INFO blocks, which are
functionally equivalent except that they don't specify priority
numbers. To compensate, this implementation adds the priority argument;
if that is not given, the script uses a fixed startup priority
of 20 and a fixed stop priority of 80, relying on processing of
the dependencies in the LSIB INIT INFO blocks to get ordering right.
On the other hand, the IRIX and Red Hat version didn't have --dryrun.
.SH SEE ALSO
.IR init (8).
.IR runlevel (8).
.SH AUTHOR
.nf
Eric S. Raymond. Portions of the manual page are from the Red Hat
implementation by Erik Troan <ewt at redhat.com>.
.fi
@jathanism
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment