Adding and quiting services with chkconfig
This implementation of chkconfig was inspired by the chkconfig command present in the IRIX operating system. Rather than maintaining configuation information outside of the /etc/rc[0-6].d hierarchy, however, this version directly manages the symlinks in /etc/rc[0-6].d.
In Redhat Linux you have a powerfull tool called chkconfig, you can list all the services with:
chkconfig --list
To see the services started in runlevel 3:
chkconfig --list | grep 3:on
To turn off a service in all the runlevels:
chkconfig pcmcia off
Turn off a service in a desired runlevel:
[root@monitor1]# chkconfig --list | grep hpoj
hpoj 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@monitor1]# chkconfig --level 3 hpoj off
[root@monitor1 rc3.d]# chkconfig --list | grep hpoj
hpoj 0:off 1:off 2:on 3:off 4:on 5:on 6:off
If you want to add a new service, you created the /etc/rc.d/init.d/ file and now you wans to manage the service, configure it to start and stop on desired runlevels.
Edit the /etc/rc.d/init.d/service-name file, and add this line on the top:
#!/bin/bash
# chkconfig: 2345 55 25
# description: A service that does powerful things
#
This is a description of what this line does:
# chkconfig: 2345 55 25
| | |
| | priority for kill scripts
| |
| priority for start scripts
|
run levels at which to start service
Then execute, for example, adding the qmail service:
[root@monitor1 init.d]# chkconfig --add qmail
[root@monitor1 init.d]# chkconfig --list qmail
qmail 0:off 1:off 2:off 3:on 4:off 5:on 6:off
Now configure it to start on desired runlevels !
Friday, October 2, 2009
Subscribe to:
Post Comments (Atom)
This article is from serverlinux.blogspot.com. Please mention it because i am the author.
ReplyDeleteامسحك حرااااااااامي ههههههههههههههههههههههههههههههههههههههههههه
ReplyDelete