Atlassian Bamboo startup script

Posted on 14 Oct, 2012 | 0 comments

Atlassian Bamboo startup script

 

Pentru cei interesati de o solutie pentru sisteme de operare care ruleaza CentOS, RHEL, Fedora, mai jos sunt citiva pasi:

 

1. Drepturile de acces la anumite fisiere si directoare trebuiesc actualizate

 

2. Creati in /etc/init.d un fisier “atlassian-bamboo” in care puneti, folosind un editor, urmatorul continut:


#!/bin/bash
#
# atlassian-bamboo Start/Stop the Atlassian BAMBOO Server
# chkconfig: 2345 80 05
# description: Atlassian BAMBOO Server
# Continuous Integration and Release Management
#
# Written by Vasile Strugaru
# Inspired by Atlassian documentation
#
# contact@vasile.strugaru.ro
# http://vasile.strugaru.ro
#
# Please check your install folders and change accordingly the necessary info
#
# processname: java
# config: /opt/BAMBOO/webapp/WEB-INF/classes/bamboo-init.properties
# pidfile: /opt/BAMBOO/bamboo.pid
#
# Usage:
# /etc/init.d/atlassian-bamboo {start|stop|help}

#
# Variables
#
BAMBOO_USER="bamboo"
BAMBOO_INSTALL="/opt/BAMBOO"
BAMBOO_HOME="/home/bamboo/bamboo-home"

#
# Bamboo specific ENV vatriable
#
RUN_AS_USER=$BAMBOO_USER

# JAVA_HOME Must point at your Java Development Kit installation.
# Required to run the with the "debug" argument.
#
# JRE_HOME Must point at your Java Development Kit installation.
# Defaults to JAVA_HOME if empty.
JAVA_HOME=/opt/jdk1.6.0_30

#
# Functions
#
start_bamboo() {
echo "Starting Atlassian BAMBOO Server: "
su -c "cd ${BAMBOO_HOME}; export RUN_AS_USER=${RUN_AS_USER}; export JAVA_HOME=${JAVA_HOME}; ${BAMBOO_INSTALL}/bamboo.sh start"
echo -e "\tDone."
echo -e "\tYou can check the log file ${BAMBOO_HOME}/logs/atlassian-bamboo.log for application startup details"
echo -e "\tand the log file ${BAMBOO_INSTALL}/logs/bamboo.log for server startup details"
}
stop_bamboo() {
echo "Shutting down BAMBOO: "
su -c "cd ${BAMBOO_HOME}; export RUN_AS_USER=${RUN_AS_USER}; export JAVA_HOME=${JAVA_HOME}; ${BAMBOO_INSTALL}/bamboo.sh stop"
echo -e "\tDone."
echo -e "\tYou can check the log file ${BAMBOO_HOME}/logs/atlassian-bamboo.log for application shutdown details"
echo -e "\tand the log file ${BAMBOO_INSTALL}/logs/bamboo.log for server shutdown details"
}
help_bamboo() {
clear
echo "Atlassian BAMBOO rc-script"
echo -e "/etc/init.d/atlassian-bamboo {start|stop|help}\n"
echo "Options:"
echo "--------"
echo -e "start\tStarts the Atlassian BAMBOO server."
echo -e "stop\tStops the Atlassian BAMBOO server."
echo -e "help\tShow this message.\n"
}
case "$1" in
start)
start_bamboo
;;
stop)
stop_bamboo
;;
help)
help_bamboo
exit 0
;;
*)
echo "Usage: /etc/init.d/atlassian-bamboo {start|stop|help}"
exit 1
;;
esac

 

3. Legaturile simbolice pentru rularea automata la pornirea si oprirea sistemului se fac prin comanda:


>sudo /sbin/chkconfig --add atlassian-bamboo

 

Informatiile necesare pentru chkconfig se afla la inceputul scriptului.

 

Info

Pentru un sistem ce utilizeaza “System V”avem:

Runlevel 0: Shuts down the system (Halt)

Runlevel 1: Single user mode (super user)

Runlevel 2: Multi user

Runlevel 3: Multi user + network

Runlevel 4: Not used/User-definable

Runlevel 5: As runlevel 3 + display manager

Runlevel 6: Reboots the system

 

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.