The Chkconfig command in CentOS

Source: Internet
Author: User
Tags stop script

Chkconfig:
The Chkconfig command is primarily used to update (start or stop) and query run-level information for system services. Keep in mind that Chkconfig does not immediately automatically disable or activate a service, it simply changes the symbolic connection.
Grammar:
Chkconfig--list [Name]
Chkconfig--add Name
Chkconfig--del Name
Chkconfig [--level levels] name <on|off|reset>
Chkconfig [--level levels] Name

Chkconfig displays usage when no parameters are run. If the service name is added, check that the service is started at the current run level. If yes, returns TRUE, otherwise false is returned. If On,off or reset is specified after the service name, CHKCONFI will change the startup information for the specified service. On and off refers to the service being started and stopped, and reset refers to the boot information of the reset service, regardless of what is specified by the problematic initialization script. On and off switches, the system is only valid for run-level 3,4,5 by default, but reset can be valid for all run levels.
The--level option allows you to specify the run level you want to view, not necessarily the current run level.
It is necessary to note that 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.

Chkconfig--list: Displays the running status information (on or off) of all run-level system services. If name is specified, only the state of the specified service at a different run level is displayed.
Chkconfig--add Name: Add a new service. Chkconfig ensure that each run level has a start (S) or Kill (K) entry. If one is missing, it is automatically created from the default init script.
Chkconfig--del Name: Deletes the service and removes the associated symbolic connection from the/ETC/RC[0-6].D.
Chkconfig [--level levels] name <on|off|reset>: Sets whether a service is started, stopped, or reset at the specified run level. For example, to stop the NFS service at the 3,4,5 run level, the command is as follows:
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 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.
For example, Random.init contains three rows:
# chkconfig:2345 20 80
# description:saves and restores system entropy pool for \
# higher quality random number generation.

Add a description of the operational level concept of the Linux system:
Linux has a variety of operating levels, the common is multi-user 2,3,4,5, many people know that 5 is the level of running X-windows, and 0 is shutdown. Changes to the run level can be toggled with the init command. For example, if you want to maintain the system into a single-user state, you can use INIT1 to switch. During the switching process of Linux running level, the system will automatically find files corresponding to the/etc/rc[0-6].d of K and S under the directory of Run level, and execute these scripts in the following numerical order. The maintenance of these scripts is a tedious thing, Linux provides the chkconfig command to update and query system services at different run levels.

The Chkconfig command in CentOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.