Chkconfig:
The chkconfig command is used to update (start or stop) and query the running level information of the system service.
Remember that chkconfig does not automatically disable or activate a service immediately, but simply changes the symbolic connection.
Syntax:
Chkconfig -- list [name]
Chkconfig -- add name
Chkconfig -- del name
Chkconfig [-- level levels] Name
Chkconfig [-- level levels]
Name
Chkconfig
When no parameter is running, the usage is displayed. If the service name is added, check whether the service is started at the current running level. If yes, true is returned; otherwise, false is returned. If you specify
On, off, or reset, then chkconfi
Changes the startup information of the specified service. On and off indicate that the service is started and stopped, and reset indicates that the Service Startup information is reset, no matter what is specified by the problematic initialization script. On and off
By default, the system is only valid for runtime Level 3, 4, and 5, but the reset can be valid for all runtime levels.
The -- level option specifies the running level to be viewed, not necessarily the current running level.
It must be noted that for each running level, there can be only one start script or stop script. When you switch the running level, init does not restart the started service or stop the stopped service again.
Service.
Chkconfig -- list
: Displays the running status information (ON or OFF) of all running-level system services ). If the name is specified, only the status of the specified service at different running levels is displayed.
Chkconfig -- add
Name: Add a new service. Chkconfig ensures that each running level has a startup (s) or kill (k) entry. If the init script is missing, it is automatically created from the default init script.
Chkconfig -- del name: Delete the service and delete the connection from/etc/rc [0-6]. D.
Chkconfig [-- level levels] Name
<On | off | reset>: sets whether a service is started, stopped, or reset at the specified running level. For example, to stop the NFS service at level 3, 4, and 5, the command is as follows:
Below:
Chkconfig -- level 345 NFS off
Run-level files:
Each service managed by chkconfig needs to add two or more lines of comments to the script in the corresponding init. d. The first line tells chkconfig the default startup stage and startup
And stop priority. If a service is not started at any running level by default, use-to replace the running level. The second line describes the service, which can be annotated with/across lines.
Example
For example, random. init contains three rows:
# Chkconfig: 2345 20 80
# Description: saves and restores system entropy pool/
# Higher quality random number generation.
This document introduces the concept of running level in Linux:
Linux has a variety of running levels. common ones are 2, 3, 4, and 5 of multiple users.
Many people know that 5 is the level of running X-Windows, and 0 is the shutdown. You can use the init command to change the running level. For example, if you want to maintain the system to enter the single-user status
You can use init1. During the Linux running-level switch, the system will automatically find the files starting with K and s under the corresponding running-level directory/etc/rc [0-6]. D,
Execute these scripts in numerical order. The maintenance of these scripts is cumbersome. Linux provides the chkconfig command to update and query system servers at different running levels.
Service.