Ubuntu – Bamboo service does not start on ubuntu server machine reboot/startup

init.dUbuntu

I have set up an instance of bamboo on a local ubuntu server machine. Everything works fine exept for one thing: Bamboo is not started when the server reboots. I have created a script and placed it in /etc/init.d/bamboo. The file has owner root:root and file permissions 755. It works fine to invoke manually, both for stop, start and restart commands. I have attatched it here below. Any reason it might not work on startup or where on my machine I might find log info about it?

#!/bin/sh -e
# bamboo startup script
#chkconfig: 2345 80 05
#description: bamboo

# Define some variables
# Name of app ( bamboo, Confluence, etc )
APP=bamboo
# Name of the user to run as
USER=bamboo
# Location of application's bin directory
BASE=/opt/atlassian/bamboo
# Location of Java JDK
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/
export HOME=/home/bamboo

case "$1" in
  # Start command
  start)
    echo "Starting $APP"
    /bin/su -m $USER -c "cd $BASE/logs && $BASE/bin/startup.sh &> /dev/null"
    ;;
  # Stop command
  stop)
    echo "Stopping $APP"
    /bin/su -m $USER -c "$BASE/bin/shutdown.sh &> /dev/null"
    echo "$APP stopped successfully"
    ;;
   # Restart command
   restart)
        $0 stop
        sleep 5
        $0 start
        ;;
  *)
    echo "Usage: /etc/init.d/$APP {start|restart|stop}"
    exit 1
    ;;
esac

e

Best Answer

You need to run:

sudo update-rc.d bamboo defaults

to make it start at boot.

defaults starts the service in runlevels 2345 and stops the service in runlevels 016.

The command adds symlinks from your /etc/init.d/bamboo to the various run-level directories in /etc. More info on the man page.