The chkconfig command under Linux is mainly used to query the system services executed by the system in each execution level. How to use the chkconfig command? The following small series will introduce you to the specific usage of the chkconfig command in Linux.
chkconfig command is used to update operational level information (start or stop) and query system services. Keep in mind that chkconfig does not automatically disable or activate a service immediately, it simply changes the symbolic link.
Using the syntax
The code is as follows:
chkconfig [--add][--del][--list][system service] or chkconfig [--level Level code"][system service][on/off/reset]
chkconfig displays usage when no parameters are run. If you add a service name, then check if the service is started at the current run level. If yes, return true, otherwise return false. If on, off, or reset is specified after the service name, chkconfig will change the startup information of the specified service. On and off respectively indicate that the service is started and stopped, and reset refers to the startup 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 levels 3, 4, 5 by default, but reset can be active for all run levels.
Parameter Usage
The code is as follows:
--add Adds the specified system service, allows the chkconfig command to manage it, and adds it to the system-initiated narration file. related data.
--del Deletes the specified system service, no longer managed by the chkconfig command, and deletes the relevant data in the system-initiated narrative file.
--level "Level Code" Specifies in which execution level the read system service is to be turned on or off.
Level 0 means: Indicates shutdown
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 Representation: Restart
It should be noted that the level option can specify the runlevel to be viewed and not necessarily the current runlevel. There can only be one startup script or stop script for each run level. When switching the run level, init will not restart the already started service, nor will it stop the stopped service again.
The code is as follows:
chkconfig --list [name]: Displays the running status information (on or off) of all runtime system services. If name is specified, only the status of the specified service at different run levels is displayed.
chkconfig --add name: Add a new service. Chkconfig ensures that each run level has a start (S) or kill (K) entry. If it is missing, it will be automatically created from the default init script.
chkconfig --del name: Delete the service and remove the associated symbolic link from /etc/rc[0-6].d.
chkconfig [--level levels] name: Set whether a service is started, stopped or reset at the specified run level.
Runlevel Files
Each service managed by chkconfig requires two or more lines of comments in the script under the corresponding init.d. The first line tells chkconfig the run level of the default start and the priority of start and stop. If a service is not started by default at any runlevel, use – instead of the runlevel. The second line describes the service and can be commented with \\ cross-row.
For example, random.init contains three lines:
The code is as follows:
# chkconfig: 2345 20 80
# description: Saves and restores system entropy Pool for \\
# higher quality random number generation.
Using the examples
The code is as follows:
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 at runlevel 2, 3, 4, 5 are all on (on) state
chkconfig --list # List all system service startup conditions
chkconfig --list mysqld #column The mysqld service settings
chkconfig --level 35 mysqld on #Set mysqld to run the service at levels 3 and 5, --level 35 means the operation is only performed at levels 3 and 5, on means start, Off means to close
chkconfig mysqld on #Set mysqld to be on each level, “ Rdquo; includes 2, 3, 4, 5 levels
How to add a service
Service scripts must be stored in the /etc/ini.d/directory;
chkconfig &ndash ;add servicename, add this service to the chkconfig tool service list, the service will be given K/S entry in /etc/rc.d/rcN.d;
chkconfig –level 35 mysqld On, modify the default startup level of the service.
The above is the introduction of the chkconfig command under Linux. I believe that you have a good understanding of the chkconfig command through this article. If you want to know more about Linux commands, you may wish to pay more attention to this website. .
If you dont understand the Linux system to replace files, it is easy to cause text
We all know that Windows systems have disk fragmentation, but not on Linux, how can
For many beginners, I dont know how to configure Java environment variables, especially in Linux sys
The FIFO pipeline is a file type. It is very easy to create a FIFO on Linux. The FI
How to remove the plus sign after the Linux Kernel version number?
Linux software raid operation guide
CentOS automatically starts the desktop service after booting
How to handle Too many open files under Linux?
Linux/Unix uses the md5sum command to compare file md5 values
Ways to debug network performance using tools under Linux
Linux system settings automatically adjust the screen brightness method
How to use the du and df commands to clear large files under Linux?
How to use the sync command on Linux
How to let ordinary users use port
How to reduce the Win7 desktop icon
How to open and use the recorder software
Win8 how to connect to the network Win8 network connection setting method
Is Windows 7 a corporate tonic or a gorgeous bomb?
How to modify the default name of Win10 new folder?
Are these disabled services for win7 skills disabled?
Windows 7 system desktop background can not be changed solution