chkconfig Command in Linux with Examples
chkconfig Command in Linux with Examples
chkconfig Command helps you to configure services for starting and stopping them automatically when the Operating System boots. This is configured in the scripts, /etc/rc.d/init.d. This tutorial covers the ground on installation of chkconfig command.
Command to list All Services in run-level
The &ndash list parameter displays all the services along with their current start up status in each run-level configuration.
[root@linuxhelp Desktop]# chkconfig --list
NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off
abrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:off
abrtd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
.
.
.
.
winbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
wpa_supplicant 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ypbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Command to check the Status of Specific Services in run-level
The following command shows the start up configuration for a particular service.
[root@linuxhelp Desktop]# chkconfig --list| grep nfs
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
Command to start a Particular Service on Run Levels
Here we use &ndash level parameter in the chkconfig command, to start httpd services only on run level 3 and 5.
[root@tecmint ~]# chkconfig --level 35 httpd o
Similarly, we can start nfs service.
[root@linuxhelp Desktop]# chkconfig--level 35 nfs on
After assigned run level state to nfs now verify the state by following command.
[root@linuxhelp Desktop]# chkconfig --list | grep nfs
nfs 0:off 1:off 2:off 3:on 4:off 5:on 6:off
Command to check Whether the Services are On / Off state in run-level
Running the following command displays all the services, which are On and Off in run level 5.
[root@linuxhelp Desktop]# chkconfig --list | grep 5:on
NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off
abrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:off
abrtd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@linuxhelp Desktop]# chkconfig --list | grep 5:off
dnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:off
firstboot 0:off 1:off 2:off 3:off 4:off 5:off 6:off
htcacheclean 0:off 1:off 2:off 3:off 4:off 5:off 6:off
kdump 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Command to stop a Particular Service on Run Levels
Running the following command will turn Off a service named nfs for a single run level and it is also possible for turning Off a service in multiple levels as illustrated below.
[root@linuxhelp Desktop]# chkconfig --level 2 nfs off
[root@linuxhelp Desktop]# chkconfig --list | grep nfs
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
If you want to give multiple run-level state you should follow the below command.
[root@linuxhelp Desktop]# chkconfig --level 234 nfs off
[root@linuxhelp Desktop]# chkconfig --list | grep nfs
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
Comments ( 0 )
No comments available