The Chkconfig command checks and sets the system's various services.
(1) Usage:
usage: chkconfig [Necessary parameters] [service]
(2) Function:
Features: the Chkconfig command is used to install, view, or modify the settings of the startup options that the services boot with the system. is a program developed by Red Hat in accordance with the GPL rules, which can query which system services the operating system performs at each level of execution, including a variety of resident services.
Note: Remember that Chkconfig does not automatically disable or activate a service immediately, it simply changes the symbolic connection.
Each service managed by Chkconfig is first added to the/ETC/INIT.D.
(3) Option parameters:
1)--add Open the specified service program
2)--del Close the specified service program
3)--list list all services known to Chkconfig
4)--level< Code > Set Service Program Class code, is a string of 0~7 numbers
(4) Example:
1) [[email protected] sunjimeng]# chkconfig--list View System Program list
[Email protected] sunjimeng]# Chkconfig--List Note: This output shows only the SysV service and does not contain the native SYSTEMD service. SysV configuration data may be overwritten by native SYSTEMD configuration. If you want to list the SYSTEMD service, please do'Systemctl list-unit-files'. To view services enabled for a specific target, perform'systemctl list-dependencies [target]'. Netconsole0: Off1: Off2: Off3: Off4: Off5: Off6: Close Network0: Off1: Off2: Open3: Open4: Open5: Open6: Off XINETD-based services: Chargen-Dgram: Guan Chargen-stream: Off daytime-Dgram: Guan Daytime-stream: Off Discard-Dgram: Guan Discard-stream: Close echo-Dgram: Close echo-stream: Off Tcpmux-server: Off time-Dgram: Close time-stream: Off
2) Check the settings of the service startup options in the shell script
" Network Service is configured " is configured
When you execute the Chkconfig plus service name, it returns true if the service is configured to start automatically.
is-is-enabled Xinetd.service ". Enabled
3) Add or remove the specified service
[Email protected]/]# chkconfig--/]# chkconfig--add netconsole
(5) Other:
1) Rank code list:
Level 0 means: shutdown
Level 1 means: Single user mode
Level 2: Multi-user command line mode with no network connection
Level 3 means: Multi-user command line mode with network connection
Level 4 means: not available
Level 5 means: Multi-user mode with graphical interface
Level 6 means: reboot
It is necessary to note that the level option can specify the run levels to view and not necessarily the current run level. For each run level, there can be only one startup script or stop script. When you switch the run level, Init does not restart the service that is already started, nor does it stop the service that has stopped.
2) Run-level files:
Each service managed by Chkconfig needs to add two or more lines of comments to the script under the corresponding INIT.D. The first line tells Chkconfig the run level of the default startup and the priority of start and stop. If a service does not start at any run level by default, use-instead of run-level. The second line describes the service, which you can annotate with \ cross-line.
One Linux command per day (chkconfig) command