Chkconfig Command Examples for Linux

Chkconfig commands are used in linux distributions to add, remove, modify and view system startup services that start automatically during starting of the system. All the information about the start up programs are located in /etc/rc.d/ directory.
And when you add a service to startup, the "chkconfig" command create a symbolic link in the appropriate subdirectories of "rc.d" directory.


View all startup services
[root@server ~]# chkconfig --list
NetworkManager  0:off   1:off   2:on    3:on    4:on    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:off   6:off
autofs          0:off   1:off   2:off   3:on    4:on    5:on    6:off
avahi-daemon    0:off   1:off   2:off   3:on    4:on    5:on    6:off
bluetooth       0:off   1:off   2:off   3:on    4:on    5:on    6:off
cgconfig        0:off   1:off   2:off   3:off   4:off   5:off   6:off

View startup status of a single service
[root@server ~]# chkconfig psacct --list
psacct          0:off   1:off   2:on    3:on    4:on    5:on    6:off

View startup services configured in individual runlevels
List all the startup services in runlevel 3
[root@server ~]# chkconfig --list | grep 3:on

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:off   6:off

autofs           0:off   1:off   2:off   3:on    4:on    5:on    6:off

avahi-daemon    0:off   1:off   2:off   3:on    4:on    5:on    6:off



How to add a service to startup
[root@server ~]# chkconfig psacct on
(by default the above command will add the "psacct" service to runlevels  2,3,4,5.)


Add a service to individual runlevels
Add the "psacct" service to runlevel 3 only.
[root@server ~]# chkconfig --level 3 psacct on


Remove a service from individual runlevels
Remove the service "psacct" from runlevel 4 only
[root@server ~]# chkconfig --level 4 psacct off



Check Related Posts:

Was this helpfull ?

0 comments:

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons