If the only requirement is to start the agent when the remote agent machine gets restarted, you can configure the start remote agent command in the rc.local file the same way as it's discussed here.
Also, use the remote agent installer jar file that comes with the supervisor (wrapper). It's the big Download button on Administration -> Agents -> Install remote agent page. The wrapper will start the remote agent service if for some reason the remote agent process gets terminated.
Ok, that's a workaround but I don't like having to work to implement things that are supposed to be part of the core product. Installing and agent as a service should be the default behaviour. Also, I am impressed that Bamboo cannot start agents via SSH, like Jenkins. Yes, the user interface of Bamboo is much nicer than Jenkins, but it seems that Bamboo is not robust enough and it may require more maintenance work than Jenkins, just because it is not able to deal with workers that could come-and-go.
Anyway, thanks for the good answer, even if it's not what I was looking for it it may be the best alternative for the moment.
For systemd on ubuntu
Contents (be sure to adjust paths and user/group):
[Unit] Description=Atlassian Bamboo Agent After=syslog.target network.target [Service] Type=forking User=apps Group=apps ExecStart=/apps/bamboo-agent/bin/bamboo-agent.sh start ExecStop=/apps/bamboo-agent/bin/bamboo-agent.sh stop [Install] WantedBy=multi-user.target
Then reload and start it (as root or using sudo)
systemctl daemon-reload systemctl start bamboo-agent
Found this on the https://github.com/alienfast/bamboozled-ruby-plugin/wiki/Remote-Agents#overview site.
For my Amazon Linux instance, all I ended up needing to do was after the standard installation and running it from the command line I then symlinked the shell script like below.
sudo ln -s /apps/bamboo-agent/bin/bamboo-agent.sh /etc/init.d/bamboo-agent
and then added the bamboo-agent to chkconfig like so
sudo chkconfig -add bamboo-agent.
Like @Kevin Ross's post I created an upstart task, which is what Ubuntu is now using (I guess). Tested on my own Ubuntu (14.04 LTS) server.
Create an Upstart config file like `/etc/init/bamboo-agent.conf` with the following text (changing the author and /home/bamboo/bin/bamboo-agent.sh path to suit your needs.
description "A Bamboo remote agent daemon job file for Upstart" author "Your name" start on runlevel  stop on shutdown pre-start script echo "[`date`] Bamboo remote agent starting" >> /var/log/bamboo-agent.log setuid bamboo exec /home/bamboo/bin/bamboo-agent.sh start end script pre-stop script exec /home/bamboo/bin/bamboo-agent.sh stop echo "[`date`] Bamboo remote agent stopping" >> /var/log/bamboo-agent.log end script
Your script almost worked on Trusty. The setgid and setuid have to be set outside the scripts, once the scripts are running as the user you cannot redirect the output to /var/log (unless you give the user access to /var/log/bamboo-agent.log. Why not use upstart's logging facility?
description "A Bamboo remote agent daemon job file for Upstart" author "Your name" start on runlevel  stop on shutdown setuid bamboo setgid bamboo pre-start script logger "[`date`] Bamboo remote agent starting" exec /opt/bamboo-agent-home/bin/bamboo-agent.sh start end script pre-stop script exec /opt/bamboo-agent-home/bin/bamboo-agent.sh stop logger "[`date`] Bamboo remote agent stopping" end script
It did for me too. Frustrating to have gone through all the online docs only to realize that they haven't updated them to match the existing functionality of bamboo-agent.sh and that magical undocumented "installstart" argument. I wasted about 2 hours trying to adapt their documentation for bamboo server (as officially instructed by their docs) to manually configure a systemd service, inspecting and troubleshooting systemd logs. Kudos to you for finding it, @Mehmet Aydogdu .