chkconfig -- runlevel maintaince tool.
chkconfig --list [name]
chkconfig --add <name> [--config run-levels,startval,killval]
chkconfig --del <name>
chkconfig --level <levels> <name> <on|off> [--config startval,killval]
chkconfig provides a simple command-line tool for maintaining the /etc/rc.d
directory hierarchy by relieving system administrators of the task of
directly manipulating the numerous symbolic links in those directories.
SGI originally created chkconfig for their IRIX operating system. RedHat created their
own C version (
found here).
This version of chkconfig was influenced by interaction with the RedHat tool.
My goal in writing this was to create a tool that would provide the basic
functionality of chkconfig. This application will work with any init.d file
including those setup for chkconfig (as defined by the RedHat man-pages for
chkconfig).
chkconfig has four distinct functions: adding new configuration for a
service, removing configuration for a service, listing the current startup
information for either all or individual services, and changing the startup
configuration for a service.
When chkconfig is run either without any options or with unknown options, it
displays usage information. If only a service name is given chkconfig will
display usage information - and NOT return true or false. The --list option
is required to query a service, and the --level option is needed to modify a
service configuration.
--level <levels> <name> <on|off> [--config startval,killval]
<levels> specifies the run levels an operation should pertain to. It
is given as a string of numbers from 0 to 7. For example, --level 35
specifies runlevels 3 and 5.
<name> specifies the name of the service an operation should pertain
to. Use --list to get a list of available services.
<on|off> specifies what the service should be set to for the given
<levels> and <name>. on means the service should be set to
start at the given <levels> and off means the service should be set
to stop at the given <levels>.
[--config startval,killval] is optional, and only needed if <name> is
not setup for chkconfig. If used the startval refers to the start
priority, and the killval refers to the stop priority.
--add <name> [--config run-levels,startval,killval]
<name> specifies the name of the service an operation should pertain
to. Use --list to get a list of available services.
[--config run-levels,startval,killval] is optional, and only needed if
<name> is not setup for chkconfig. If used the run-levels refers to
the runlevels to add the service to as 'on', startval refers to the start
priority, and the killval refers to the stop priority.
--del <name>
<name> specifies the name of the service an operation should pertain
to. Use --list to get a list of available services.
The del command will unconfigure <name>.
--list [name]
This will list all scripts (except those explicitly ignored by
configuration) and whether they are stopped, started, or unconfigured in
each runlevel. On refers to starting at a given run level. Off refers to
stopping at a given run level. Off* means that the service is unconfigured
at a given runlevel. [name] is optional, if given only the information for
[name] will be shown.
Chkconfig is minimally configurable, the following variables can be changed -
most only need to be changed for testing.
$BASEDIR
BASEDIR is used to configure the directory that contains
initialization directories (rc[0-S].d).
$SCRIPTDIR
SCRIPTDIR is the directory containing all init scripts.
This is usually "$BASEDIR/init.d".
$SCRIPT_IGNORE = ".dpkg-dist,README";
SCRIPT_IGNORE is used to define strings that if found should be ignored.
Each string is separated by a ',' (comma). If a script name contains any
of the strings defined the script will not be used/maintained by
chkconfig. By default SCRIPT_IGNORE is ".dpkg-dist,README".
$MAXINITLVL
MAXINITLVL is 1 less than the total number of init levels available.
Another way to think about it would be the # of your highest init level.
This value is usually 6.
@INITDIRS
INITDIRS is the defined list of the init directories from lowest to
highest, followed by the 'Startup' level (usually rcS.d).
If you find a bug please let me know email me at
thompson@cns.uni.edu.
Copyright (C) 2003 Aaron Thompson
thompson@cns.uni.edu
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA. or visit
http://www.gnu.org/copyleft/gpl.html
Click here to view the source code online
Click here to download the script