Running Bamboo as a Linux service
Running Bamboo as a service
On this page
Related content
- Javascript Error when accessing Issues link in Project Navigation after Upgrade
- JVM Segfault (SIGSEGV) After Plugin Initialisation
- SIGSEGV Segmentation Fault JVM Crash
- Uncaught QuotaExceededError displays in browser using Jira server
- Character Encoding Issues when using JASIG CAS Authenticator
- JIRA Agile error during page load - curl already exists
- How to fetch the Team name from the comments by using Regex
- JIRA Agile is currently unavailable error when Restoring the JIRA Cloud backup to JIRA 6.4.5 with JIRA Agile 6.7.4
- Error "Field with id' xxx' and name 'Team' does not support operation 'add' Supported operation(s) are: 'set'" on Jira Align Connector
- Configure the look and feel of Jira applications
Linux system administration is outside the scope of Atlassian support. This page is provided for your information only.
On Linux/Solaris, the best practice is to install, configure and run each service (including Bamboo) as a dedicated user with only the permissions they require.
To install, configure and get Bamboo to start automatically on Linux/Solaris:
Create a bamboo user account that will be used to run Bamboo. For example, enter the following at a Linux console:
sudo useradd --create-home -c "Bamboo role account" bamboo
Create a directory into which Bamboo will be installed. For example:
sudo mkdir -p /opt/atlassian/bamboo sudo chown bamboo: /opt/atlassian/bamboo
Log in as the bamboo user to install Bamboo:
sudo su - bamboo
You need to extract Bamboo:
cd /opt/atlassian/bamboo tar zxvf /tmp/atlassian-bamboo-X.Y.tar.gz ln -s atlassian-bamboo-X.Y/ current
- Edit
current/atlassian-bamboo/WEB-INF/classes/bamboo-init.properties
and setbamboo.home=/var/atlassian/application-data/bamboo (or any other directory of your choice, but not the same as Bamboo's installation directory)
- Proceed with the service configuration. There are two options included below for creating the service configuration, which one you will use will depend on your Linux distribution:
Suitable for modern distributions such as:
- Ubuntu 15
- CentOS 7
- RHEL 7
For anything older see the SysV Init Script section below.
Systemd will ignore environment variable definitions placed in /etc/environment as well as other traditional environment variable definitions from Sys-V init. If one needs to define environment variables when running Bamboo as a systemd unit then the variable definitions need to be placed in the unit file.
The examples below are designed for Bamboo Server. If you want to automate the Remote Agent service, simply replace ExecStart/ExecStop instructions with:
ExecStart=<bamboo-agent-home>/bin/bamboo-agent.sh start sysd
ExecStop=<bamboo-agent-home>/bin/bamboo-agent.sh stop sysd
Environment=CATALINA_PID
and PIDFile
properties can be removed as the Remote Agent startup is controlled by a service wrapper.
Create a
bamboo.service
file in your/etc/systemd/system
directory[Unit] Description=Atlassian Bamboo After=syslog.target network.target [Service] Type=forking User=<bamboo-user> Environment=CATALINA_PID=<bamboo-install>/bin/Catalina.pid PIDFile=<bamboo-install>/bin/Catalina.pid ExecStart=<bamboo-install>/bin/start-bamboo.sh ExecStop=<bamboo-install>/bin/stop-bamboo.sh SuccessExitStatus=143 [Install] WantedBy=multi-user.target
The values for
<bamboo-user>
and<bamboo-install>
should be replaced with your Bamboo user and the path to your Bamboo Install directory, respectively.CATALINA_PID
andPIDFile
are also declared, this way systemd knows which java process to monitor.Enable the service to start at boot time by running the following in a terminal:
systemctl enable bamboo.service
- Stop Bamboo using the provided Bamboo stop script (
<bamboo-install>/bin/stop-bamboo.sh
) and restart your system to check that Bamboo starts as expected Use the following commands to manage the service:
Disable the service:systemctl disable bamboo.service
Check that the service is set to start at boot time:if [ -f /etc/systemd/system/*.wants/bamboo.service ]; then echo "On"; else echo "Off"; fi
Manually start and stop the service:systemctl start bamboo systemctl stop bamboo
Check the status of Bamboo:systemctl status bamboo
As root, create the file
/etc/init.d/bamboo
(code shown below), which will be responsible for starting up bamboo after a reboot (or when manually invoked).#!/bin/sh set -e ### BEGIN INIT INFO # Provides: bamboo # Required-Start: $local_fs $remote_fs $network $time # Required-Stop: $local_fs $remote_fs $network $time # Should-Start: $syslog # Should-Stop: $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Atlassian Bamboo Server ### END INIT INFO # INIT Script ###################################### # 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/current case "$1" in # Start command start) echo "Starting $APP" /bin/su - $USER -c "export BAMBOO_HOME=${BAMBOO_HOME}; $BASE/bin/startup.sh &> /dev/null" ;; # Stop command stop) echo "Stopping $APP" /bin/su - $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 exit 0
Make the init script executable:
chmod a+x /etc/init.d/bamboo
- Place symlinks in the run-level directories to start and stop this script automatically.
For Debian-based systems:
update-rc.d bamboo defaults
The following commands will be executed to place symlinks in the run-level directories:
Adding system startup for /etc/init.d/bamboo ... /etc/rc0.d/K20bamboo -> ../init.d/bamboo /etc/rc1.d/K20bamboo -> ../init.d/bamboo /etc/rc6.d/K20bamboo -> ../init.d/bamboo /etc/rc2.d/S20bamboo -> ../init.d/bamboo /etc/rc3.d/S20bamboo -> ../init.d/bamboo /etc/rc4.d/S20bamboo -> ../init.d/bamboo /etc/rc5.d/S20bamboo -> ../init.d/bamboo
For RedHat-based systems:
the init.d script contains chkconfig settings
sudo /sbin/chkconfig --add bamboo
- Ensure the script is executed in the correct order, in particular after the database startup script.
Note: If starting your new bamboo
service fails immediately with an error, it may be that your /etc/init.d/bamboo
script has had carriage return characters introduced into it. You can confirm this by running:
cat -v /etc/init.d/bamboo
If there are carriage return characters in your /etc/init.d/bamboo
script, they will appear as ^M
in the output:
#!/bin/sh^M
set -e^M
### BEGIN INIT INFO^M
# Provides: bamboo^M
# Required-Start: $local_fs $remote_fs $network $time^M
# Required-Stop: $local_fs $remote_fs $network $time^M
# Should-Start: $syslog^M
# Should-Stop: $syslog^M
You can remove carriage return characters from /etc/init.d/bamboo
with the following command:
sed -i -e 's/\r//g' /etc/init.d/bamboo
Retry starting the service after making this change.
Related content
- Javascript Error when accessing Issues link in Project Navigation after Upgrade
- JVM Segfault (SIGSEGV) After Plugin Initialisation
- SIGSEGV Segmentation Fault JVM Crash
- Uncaught QuotaExceededError displays in browser using Jira server
- Character Encoding Issues when using JASIG CAS Authenticator
- JIRA Agile error during page load - curl already exists
- How to fetch the Team name from the comments by using Regex
- JIRA Agile is currently unavailable error when Restoring the JIRA Cloud backup to JIRA 6.4.5 with JIRA Agile 6.7.4
- Error "Field with id' xxx' and name 'Team' does not support operation 'add' Supported operation(s) are: 'set'" on Jira Align Connector
- Configure the look and feel of Jira applications