chkconfig – init.d

In UNIX systems, there are a few different ways to get stuff to automatically come back up after a restart.

CHKCONFIG
In RHEL5, you’re probably going to start and stop programs with the syntax.

/sbin/service httpd restart

In order to do that, you need to do a few things. First, make sure there’s a shell script in /etc/init.d called httpd. And in that script there need to be two special lines, one with a run level map, and another with a description.

The first few lines of any init.d script will look something like this.

[root@hostname /etc/init.d]# head httpd
#!/bin/bash
#
# chkconfig: 2345 55 25
# description: Apache HTTPD Server
#

2345 refers to which unix run levels it should run under, and run level 3 is most likely the one you’re hoping to get the service running under.

Then you turn push out the scripts to the appropirate directories.

root@sgw1:~$ chkconfig –level 345 httpd on

Then, just make sure it’s there.

root@sgw2:~$ chkconfig –list |grep httpd

Don’t forget to bounce the box to test!

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.