Chkconfig
来自 ChinaUnix Wiki
Linux命令:chkconfig
功能说明:检查,设置系统的各种服务。
语 法:chkconfig [--add][--del][--list][系统服务] 或 chkconfig [--level <等级代号>][系统服务][on/off/reset]
补充说明:这是Red Hat公司遵循GPL规则所开发的程序,它可查询操作系统在每一个执行等级中会执行哪些系统服务,其中包括各类常驻服务。
参 数: --add 增加所指定的系统服务,让chkconfig指令得以管理它,并同时在系统启动的叙述文件内增加相关数据。 --del 删除所指定的系统服务,不再由chkconfig指令管理,并同时在系统启动的叙述文件内删除相关数据。 --level<等级代号> 指定读系统服务要在哪一个执行等级中开启或关毕
英文版本,欢迎翻译:
NAME chkconfig - updates and queries runlevel information for system services
SYNOPSIS chkconfig --list [name] chkconfig --add name chkconfig --del name chkconfig [--level levels] name chkconfig [--level levels] name
DESCRIPTION chkconfig 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 chkconfig was inspired by the chkconfig command present in the IRIX operating system. Rather than maintaining configuration information outside of the /etc/rc[0-6].d hierarchy, how? ever, this version directly manages the symlinks in /etc/rc[0-6].d. This leaves all of the configuration information regarding what services init starts in a single location.
chkconfig has five distinct functions: adding new services for management, removing services from man? agement, listing the current startup information for services, changing the startup information for ser? vices, and checking the startup state of a particular service.
When chkconfig 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, chkconfig returns true; otherwise it returns false. The --level option may be used to have chkconfig query an alternative runlevel rather than the current one.
If one of on, off, or reset is specified after the service name, chkconfig changes the startup informa? tion for the specified service. The on and off flags cause the service to be started or stopped, respectively, in the runlevels being changed. The reset flag resets the startup information for the service to whatever is specified in the init script in question.
By default, the on and off options affect only runlevels 3, 4, and 5, while reset 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 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.
OPTIONS --level 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.
--add name
This option adds a new service for management by chkconfig. When a new service is added, chkcon? fig ensures that the service has either a start or a kill entry in every runlevel. If any run? level is missing such an entry, chkconfig creates the appropriate entry as specified by the default values in the init script.
--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.
--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 in only display about service name.
RUNLEVEL FILES Each service which 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, as well as 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 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.
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 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.
SEE ALSO init(8) ntsysv(8) tksysv(8)
AUTHOR Erik Troan <ewt@redhat.com>
Wed Oct 8 1997 1
