linux-Service Management Command Chkconfig

Source: Internet
Author: User

linux-Service Management Command Chkconfig

A brief introduction to 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.

Two grammars

chkconfig [--add][--del][--list][system service] or Chkconfig [--level < class Code >][system service][on/off/reset]

Parameter usage:
--add adds the specified system service, allows the CHKCONFIG directive to manage it, and adds relevant data to the system-initiated narrative file.
--del deletes the specified system service, is no longer managed by the Chkconfig directive, and deletes the relevant data within the system-initiated narrative file.
--level< Class code > Specify which execution level the system service should be opened or closed.
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

Attention:

1.chkconfig displays usage when no parameters are running.

2. Add the service name, then check whether the service returns true at the current run level, otherwise false. If On,off or reset is specified after the service name, CHKCONFI will change the startup information for the specified service. On and off respectively refer to the service being started and stopped, and reset refers to the boot information of the Reset service.

3.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.

Example:

Add Service

Chkconfig--add Name (service script must reside in/etc/ini.d/directory)

Delete Service

Chkconfig--del Name

Modify Service

Chkconfig--level name on/off

View service Status

Service Name Status

Open service

Service Name Start

Stop Service

Service Name Stop

Query computer-Installed services

Prm:chkconfig--list

SOURCE installation: General/usr/local under

The installation directory for the service is under/ETC/RC.D/INIT.D

Ls-lh/etc/rc.d/init.d

Other examples:

Chkconfig--list #列出所有的系统服务
Chkconfig--add httpd #增加httpd服务
Chkconfig--del httpd #删除httpd服务
Chkconfig--level httpd 2345 on #设置httpd在运行级别为2, 3, 4, 5 in the case of On (open) state
Chkconfig--list #列出系统所有的服务启动情况
Chkconfig--list mysqld #列出mysqld服务设置情况
Chkconfig--level mysqld on #设定mysqld在等级3和5为开机运行服务,--level 35 means that the operation is performed only on levels 3 and 5, on means start, off means off
Chkconfig mysqld on #设定mysqld在各等级为on, "each level" includes 2, 3, 4, 5 ratings

linux-Service Management Command Chkconfig

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.