1

I've got a script in ubuntu 9.04 in init.d that I've set to run on start on with update-rc.d using update-rc.d init_test defaults 99. All of the symlinks are there and the permissions appear to be correct

-rwxr-xr-x  1 root root   642 2010-10-28 16:44 init_test

mike@xxxxxxxxxx:~$ find /etc -name S99* | grep init_test
find: /etc/rc5.d/S99init_test
find: /etc/rc4.d/S99init_test
find: /etc/rc2.d/S99init_test
find: /etc/rc3.d/S99init_test

The script runs through source and ./ without issue and behaves correctly. Here is the source of the script:

#!/bin/bash
### BEGIN INIT INFO
# Provides:          init test script
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

start() {
    echo "hi"
    echo "start called" >> /tmp/test.log
    return
}

stop() {
    echo "Stopping"
}

echo "Script called" >> /tmp/test.log

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    *)
        echo "Usage:  {start|stop|restart}"
        exit 1
        ;;
esac
exit $?

When the machine starts, I don't see "script called" or "start called" in the test.log at all. Is there anything obvious I'm messing up?

1

1 Answer 1

0

I figured out what was going wrong. There was a completely unrelated script that was getting blocked on startup because it was asking for an keypress from the user which seems to stall all other startup scripts. Is there a way to troubleshoot stuff like that such as logging which init.d scripts get run?

1
  • 2
    If you put set -x in a shell script, it will print a trace of every subsequent command on its standard error. Oct 30, 2010 at 1:11

You must log in to answer this question.

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