Friday, November 03, 2017

Bamboo Auto-start script in Linux

Since there are diverse flavours of Linux distributions out there, Bamboo agent installation does not create a auto-start service automatically during the agent installation.

Using the below mentioned steps you can create a Bamboo auto-start service. Below instructions are tested under CentOS 7, however; they should work for any systemd based Linux systems with minor variations.

Creating the Bamboo service

  1. Login to the Bamboo system console over SSH/directly.
  2. Switch to super user.
    su -
  3. Create the bamboo.service file inside the directory /etc/systemd/system. Set the proper file permission.
    touch /etc/systemd/system/bamboo.service
    chmod 664 /etc/systemd/system/bamboo.service
  4. Enter the following command to insert the bamboo.service file contents
    echo "[Unit]
    Description=Bamboo startup Agent
    After=syslog.target network.target
    [Service]
    Type=forking
    User=buildadmin
    ExecStart=/home/buildadmin/Bamboo/bamboo-home/bin/bamboo-agent.sh start &
    ExecReload=/home/buildadmin/Bamboo/bamboo-home/bin/bamboo-agent.sh restart &
    ExecStop=/home/buildadmin/Bamboo/bamboo-home/bin/bamboo-agent.sh stop &
    [Install]
    WantedBy=multi-user.target" > /etc/systemd/system/bamboo.service
    Note:Here buildadmin is the user who is configured to run the Bamboo. Also ensure that you replace the Bamboo start script location with the actual location where it is installed in your system.

Now you can enable and start the service using the usual systemctl commands.
systemctl enable bamboo.service
systemctl start bamboo.service

Tags: Bamboo, Linux, systemd, auto-start, init-script.

No comments: