Chkconfig command details

Source: Internet
Author: User
Tags stop script
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 [-- add] [-- del] [-- list] [System Service] Or chkconfig [-- level <level code>] [System Service] [ON/OFF/Reset]
The usage of chkconfig is displayed when no parameter is available. 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 on, off, or reset is specified after the service name, 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 are enabled. By default, the system is only valid for runtime Level 3, 4, and 5, but the reset can be valid for all runtime levels.
Parameter usage: -- add adds the specified system service, enables the chkconfig command to manage it, and adds relevant data in the system startup description file. -- DEL: deletes the specified system service. It is no longer managed by the chkconfig command, and relevant data is also deleted in the description file started by the system. -- Level <level code> specifies the execution level of the read system service. Level 0: shutdown Level 1: Single User Mode Level 2: multi-user command line mode without network connection Level 3: multi-user command line mode with network connection level 4: unavailable Level 5: multi-user mode with graphic interface level 6: restart needs to be noted that, the level option specifies the running level to be viewed, not necessarily the current running level. For each running level, only one startup script or stop script is allowed. When you switch to the running level, init does not restart the started service or stop the stopped service again.
Chkconfig -- list [name]: 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: sets whether a service is started, stopped, or reset at the specified running level.
Run-level file: 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 default startup running level and the start 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. You can use the \ cross-line comment. For example, random. init contains three rows: # chkconfig: 2345 20 80 # Description: saves and restores system entropy pool for \ # higher quality random number generation.
Example: chkconfig -- list # list all system services chkconfig -- add httpd # Add HTTPd service chkconfig -- del httpd # Delete HTTPd service chkconfig -- level httpd 2345 on # Set httpd to 2 at runtime level, 3, 4, and 5 are all on (Enabled) status chkconfig -- list # list all System Service Startup conditions chkconfig -- list mysqld # list mysqld service settings chkconfig -- level 35 mysqld on # Set mysqld to run at level 3 and 5 service, -- level 35 indicates that the operation is only executed at levels 3 and 5, on indicates that the operation is started, and off indicates that chkconfig mysqld on is disabled # Set mysqld to on at various levels, "Each level" includes 2, 3, 4, and 5 levels
How to add a service: 1. the service script must be stored in/etc/ini. d/directory; 2. chkconfig -- add servicename add this service to the chkconfig tool service list. The service will be added to/etc/rc. d/rcN. D is assigned to the K/S entry; 3. chkconfig -- level 35 mysqld on modify the default Service Startup level.

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.