ongoing Linux Command series where we are going to review how we can useChkconfigcommand efficiently with it ' s available parameters. The ChkconfigCommand tool allows to configure services start and stop automatically in the /ETC/RD.D/INIT.DScripts through command line. Let's see some examples.
1. List All Services
using '
[Email protected] ~]# chkconfig--listnetworkmanager 0:off 1:off 2:on 3:on 4:on 5:on 6:offabrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:offabrt-oops 0:off 1:off 2:off 3:on 4:off 5:on 6:off ...
2. Check Status of specific Service
below command shows startup configuration for a particular service. It ' s Showing http Services is Turned off in the all run levels.
[Email protected] ~]# Chkconfig--list | grep httpdhttpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
3. How does I Start a particular Service on Run levels
The following 'Chkconfig' Command shows how we can startHTTPServices only on the run level3and5With '–level' Parameter. First command startshttpdServices on Run level3and5And second command verifies the status ofhttpdServices running on run level.
[Email protected] ~]# chkconfig--level httpd on
[Email protected] ~]# Chkconfig--list | grep httpdhttpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
4. How to Check which Services is on/off
The following command would display all the services which is onandOffIn specific run level5.
[[email protected] ~]# chkconfig--list | grep 5:onnetworkmanager 0:off 1:off 2:on 3:on 4:on 5:on 6:offabrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:offabrt-oops 0:off 1:off 2:off 3:on 4:off 5:on 6:offabrtd 0:off 1:of F 2:off 3:on 4:off 5:on 6:offacpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off ...
[[email protected] ~]# chkconfig--list | grep 5:offdnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:offdovecot 0:off 1:off 2:off 3:o FF 4:off 5:off 6:offfirstboot 0:off 1:off 2:off 3:off 4:off 5:off 6:offkdump 0:off 1:o FF 2:off 3:off 4:off 5:off 6:offmysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:offnetconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:offnfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off ...
5. How does I Stop a particular Service on Run levels
The following command would turnedOffA service calledpostfixFor a just single run level. Similarly, we can turnOffA particular service in multiple run levels in one go as shown under.
[[email protected] ~]# chkconfig--level 3 postfix off
[[email protected] ~]# chkconfig--level 2345 postfix off
As we all know, there is seven run levels is available on Linux Operating System. We ll cover the significant of different run levels and booting sequence in details in our upcoming article. So, please stay tuned.