1

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

1 Answers1

1

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.

garethTheRed
  • 4,009
  • 13
  • 20
  • Thanks. This worked. However I have also installed JIRA locally and added an init.d script for it but that worked out of the box. No need for this command. So what change did this make here? – Ludwig Magnusson Oct 13 '14 at 15:06
  • Presumably the package mantainer of `JIRA` configured the `deb` so that it runs `update-rc.d` on install, while the `bamboo` maintainer didn't. Which is correct is a matter of debate. The former is easier (everything "Just Works") while the latter is safer (is the cofiguration correct for your system and safe to start?) – garethTheRed Oct 13 '14 at 15:18