Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use of the chkconfig command

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "the use of chkconfig command". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the use of chkconfig command".

The chkconfig command checks and sets up various services of the system. This is a program developed by Red Hat following the GPL rules, which can query which system services are performed by the operating system at each execution level, including various resident services. Keep in mind that chkconfig does not automatically disable or activate a service immediately, it simply changes symbolic connections.

Syntax chkconfig (option) option-- add: add the specified system service to allow the chkconfig instruction to manage it, and at the same time add relevant data to the narrative file started by the system;-- del: delete the specified system service, which is no longer managed by the chkconfig instruction, and delete the relevant data in the narrative file started by the system at the same time;-- level: specify the execution level at which the read system service is to be turned on or off.

List of grade codes:

Level 0 indicates that the computer is turned off

Level 1 means: single user mode

Level 2 means: multi-user command line mode without 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: restart

It is important to note that the level option specifies the runlevel to view, not necessarily the current runlevel. There can be only one start script or stop script per runlevel. When switching runlevels, init does not restart services that have already been started, nor does it stop services that have been stopped again.

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 default run level to start and the priority to start and stop. If a service is not started at any runtime level by default, use-instead of runlevel. The second line describes the service and can be commented with\ cross-line comments.

For example, random.init contains three lines:

# chkconfig: 2345 20 8 description: Saves and restores system entropy pool for\ # higher quality random number generation. The instance chkconfig-list # lists all the system services. Chkconfig-add httpd # adds httpd services. Chkconfig-- del httpd # removes the httpd service. Chkconfig-level httpd 2345 on # sets httpd to be on when runlevels are 2, 3, 4, 5. Chkconfig-list # lists the startup of all the services in the system. Chkconfig-- list mysqld # lists the mysqld service settings. Chkconfig-- level 35 mysqld on # sets mysqld to boot at levels 3 and 5,-- level 35 indicates that the operation is performed only at levels 3 and 5, on indicates startup, and off indicates shutdown. Chkconfig mysqld on # sets mysqld to on at each level, and "each level" includes levels 2, 3, 4, and 5.

How to add a service:

Service scripts must be stored in the / etc/ini.d/ directory

Chkconfig-add servicename adds this service to the list of chkconfig tool services, and the service will be given an entry in / etc/rc.d/rcN.d

Chkconfig-the default startup level of the level 35 mysqld on modification service.

Thank you for your reading, the above is the content of "the use of chkconfig command", after the study of this article, I believe you have a deeper understanding of the use of chkconfig command, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report