3

I am trying to get Chandler running on a debian box on startup under user 'chandler', and have tried the following script, locating it in init.d:

#! /bin/sh
#
# /etc/init.d/chandler
#

RETVAL=$?
CHANDLER_HOME="/chandler"

# check input
case "$1" in
  start)
    if [ -f $CHANDLER_HOME/bin/osafsrvctl ];
      then
        /bin/su chandler $CHANDLER_HOME/bin/osafsrvctl start
    fi
    ;;
  stop)
    if [ -f $CHANDLER_HOME/bin/osafsrvctl ];
      then
        /bin/su chandler $CHANDLER_HOME/bin/osafsrvctl stop
    fi
    ;;
  *)
    echo "Usage: /etc/init.d/osafsrvctl {start|stop}"
    exit 1
    ;;
esac

exit $RETVAL

I then ran:

update-rc.d chandler defaults

I've checked that the startup scrip in init.d has 755 permissions... but no joy.

Am I missing something obvious here?

Thanks for any pointers.

UPDATE: per the suggestions below, here is the init header I've added to the script:

### BEGIN INIT INFO
# Provides:          chandler
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop chandler server
### END INIT INFO
Unpossible
  • 143
  • 1
  • 9

1 Answers1

2

Look at other scripts in /etc/init.d and you should see an LSB header comment block that looks similar to this example from fetchmail:

### BEGIN INIT INFO
# Provides:          fetchmail
# Required-Start:    $network $local_fs $remote_fs
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      1
# Short-Description: init-Script for system wide fetchmail daemon
### END INIT INFO

This type of block is required.

From man update-rc.d:

update-rc.d has two modes of operation for installing scripts into the boot sequence. A legacy mode where command line arguments are used to decide the sequence and runlevel configuration, and the default mode where dependency and runlevel information in the init.d script LSB comment header is used instead. Such header is required to be present in init.d scripts. See the insserv(8) manual page for details about the LSB header format.

Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151
  • Done, confirmed all symlinks created K**chandler, S**chandler for each rc*.d directory. Still doesn't come up on reboot. – Unpossible Sep 09 '10 at 14:47
  • @Paul: Please post the actual header as an edit to your question. Do you get anything in your logs? – Dennis Williamson Sep 09 '10 at 15:26
  • OK, might have found the issue... the startup script, when run by the system vs a user, is complaining about missing env variable JAVA_HOME, which I had defined in /etc/profile... sorry for such a basic question, but where should I be defining env variables that the system can use? – Unpossible Sep 09 '10 at 15:45
  • Got it figured out, exported JAVA_HOME from the chandler script. Thanks for the help. – Unpossible Sep 09 '10 at 17:57
  • @pmmenneg: I would define them in, for example, `/etc/default/chandler` or `/etc/default/local` then source that in your script using `. /etc/default/chandler` or `. /etc/default/chandler`. – Dennis Williamson Sep 09 '10 at 18:10
  • @Dennis: absolutely perfect, thank you for the suggestion! – Unpossible Sep 10 '10 at 15:39