Skip to content

Instantly share code, notes, and snippets.

@matmannion
Created May 30, 2014 14:39
Show Gist options
  • Save matmannion/5bdc99128f9a73bf4222 to your computer and use it in GitHub Desktop.
Save matmannion/5bdc99128f9a73bf4222 to your computer and use it in GitHub Desktop.
#!/bin/sh -e
# bamboo startup script
#chkconfig: 2345 80 05
#description: bamboo-agent
 
# Define some variables
# Name of app ( bamboo, Confluence, etc )
APP=bamboo-agent
# Name of the user to run as
USER=bamboo
# Location of application's bin directory
BASE=/data/home/admin
BAMBOO_HOME=/data/bamboo
# Location of Java JDK
export JAVA_HOME=/usr/lib/jvm/jdk-1.7.0
 
case "$1" in
  # Start command
  start)
    echo "Starting $APP"
    /bin/su -m $USER -c "$JAVA_HOME/bin/java -Dbamboo.home=$BAMBOO_HOME -jar $BASE/atlassian-bamboo-agent.jar http://build.elab.warwick.ac.uk/agentServer/ start &> /dev/null"
    ;;
  # Stop command
  stop)
    echo "Stopping $APP"
    /bin/su -m $USER -c "$JAVA_HOME/bin/java -Dbamboo.home=$BAMBOO_HOME -jar $BASE/atlassian-bamboo-agent.jar http://build.elab.warwick.ac.uk/agentServer/ stop &> /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
 
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment