first of all, we need to know some of the running levels of Linux programs Run-level
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: Some distributions of Linux use this level to enter the X Windows system
Level 5 means: Multi-user mode with graphical interface
Level 6 means: reboot
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 init 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.
Chkconfig This program can be/etc/rc.d/init.d/inside the executable service and/ETC/XINETD.D inside the related executable services, link to your designated run-level.
Note :/etc/init.d/is a link to/etc/rc.d/init.d/, such as an experiment:
How to use Chkconfig
# chkconfig [--level levels] [--list|add|del] [service name]
Parameter description:
--level: The same explains the different run-level can be set!
--list: List Run-level If the package name is on boot?!
--add: Add a service_name to start the boot;
--del: Delete a boot-start service!
Service Name: This must actually exist in the/ETC/RC.D/INIT.D directory.
Common commands:
List all services managed by chkconfig on the current system
# chkconfig--list
List the run level of a service
# chkconfig--list MySQL
Displays services that are currently started at run Level 3
# chkconfig--list | grep ' 3:on '
Add a service that uses Chkconfig management
# chkconfig--add MySQL
Enable MySQL to start service/Shut down service at 2345 RunLevel
# chkconfig MySQL on
# chkconfig MySQL off
Let the MySQL service start when the run level is 3:
# chkconfig--level 3 MySQL on
Comprehensive usage Examples:
References:
- System Settings Common directives
- Understanding System Services (Daemons)
CentOS uses Chkconfig management system services default startup or not