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
4
  • What specifically is not working? Have you tried to run the script manually?
    – EEAA
    Sep 9, 2010 at 4:05
  • Running the above script from the command line as root (/etc/init.d/chandler start), it starts without error.
    – Unpossible
    Sep 9, 2010 at 4:17
  • Did the update-rc.d script create all of the /etc/rcX.d/* symlinks correctly?
    – EEAA
    Sep 9, 2010 at 5:15
  • Yep, all symlinks are there, using the init info comment below as well.
    – Unpossible
    Sep 9, 2010 at 14:46

1 Answer 1

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.

6
  • Done, confirmed all symlinks created Kchandler, Schandler for each rc*.d directory. Still doesn't come up on reboot.
    – Unpossible
    Sep 9, 2010 at 14:47
  • @Paul: Please post the actual header as an edit to your question. Do you get anything in your logs? Sep 9, 2010 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 9, 2010 at 15:45
  • Got it figured out, exported JAVA_HOME from the chandler script. Thanks for the help.
    – Unpossible
    Sep 9, 2010 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. Sep 9, 2010 at 18:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .