Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to add to the auto start at boottime a linux service through the

chkconfig -add <servicename>

and I get a message saying

service <servicename> does not support chkconfig

I am using Red Hat Enterprise 4. The script I am trying to add to the autostart at boottime is the following:


soffice_start() {   if [ -x /opt/openoffice.org2.4/program/soffice ]; then
        echo "Starting Open Office as a Service"
        #echo " soffice -headless -accept=socket,port=8100;urp;StarOffice.ServiceManager
-headless -accept="socket,host=,port=8100;urp;StarOffice.ServiceManager"
-nofirststartwizard &   else
        echo "Error: Could not find the soffice program. Cannot Start SOffice."   fi }

soffice_stop() {   if [ -x /usr/bin/killall ]; then
        echo "Stopping Openoffice"
        /usr/bin/killall soffice 2> /dev/null   else
        echo "Eroor: Could not find killall.  Cannot Stop soffice."   fi }

case "$1" in  'start')    soffice_start    ;;  'stop')    soffice_stop    sleep 2    ;;  'restart')    soffice_stop    sleep 5  soffice_start    ;;  *)    if [ -x /usr/bin/basename ]; then
        echo "usage: '/usr/bin/basename $0' start| stop| restart"    else
        echo "usage: $0 start|stop|restart"    fi esac
share|improve this question
is your service in init.d/ –  Rungano Jun 22 '09 at 15:12
Yes. It is on inet.d. Thanks for your question. –  Geo Jun 22 '09 at 15:53

2 Answers 2

up vote 22 down vote accepted

The script must have 2 lines:

# chkconfig: <levels> <start> <stop>
# description: <some description>

for example:

# chkconfig: 345 99 01
# description: some startup script

345 - levels to configure
99 - startup order
01 - stop order

After you add the above headers you can run chkconfig --add

share|improve this answer
The extra space on the second line was added by markdown, it is not needed –  katriel Jun 22 '09 at 15:19
Thanks, those two lines did it! –  Geo Jun 22 '09 at 16:10
Here is some more information on the Run Levels and other things. tldp.org/HOWTO/HighQuality-Apps-HOWTO/boot.html –  Pred Aug 21 at 21:00

While katriel has already answered this with the bare minimum needed to create an init script, I think you'd also be well served with looking at /etc/init.d/skeleton and using that as a template on which to base your init script. You'll end up with a much more consistent and readable script.

share|improve this answer
Theoretically good advice, but /etc/init.d/skeleton is not present on RHEL systems, only on Debian and related (Ubuntu, I think). –  Harlan Feb 18 '11 at 16:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.