unix

How do add my init script to my Linux server with chkconfig?

In order to support chkconfig, an init script must:

1. It must be located in /etc/rc.d/init.d (which /etc/init.d is a symlink to)
2. It must be executable (chmod +x /etc/rc.d/init.d/)
2. It should have a commented out line that contains “chkconfig:
3. A commented out line that contains “description:
4. Upon a successful startup of the service, place a lock file in /var/lock/subsys that matches the name of the service script. Upon a successful service shutdown, the lockfile must be removed.

An example is shown below.

#!/bin/sh
#
# My Process
#
# chkconfig: 2345 60 20
# description: My process

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top