I use Bamboo onDemand, which uses Amazon EC2, to build my project. After building it, I would like to create a new snapshot of the EBS volume, so I can use it later in another Amazon EC2 instance and run the built project.
I voted for this proposal to be developed: Provide functionality for automated EBS snapshot updates
But I can't wait for it to be developed, so I followed these steps to do it manually: https://confluence.atlassian.com/display/BAMBOO042/Configuring+elastic+instances+to+use+the+EBS#ConfiguringelasticinstancestousetheEBS-updatesnapshotUpdatingyourEBSsnapshot
This works ok, but I need that Bamboo does that for me, so I made this script:
#!/bin/bash
echo 'Superuser...'
sudo su
echo 'Moving outside the EBS volume...'
cd /
echo 'Killing all java processes...'
killall java
echo 'Generating new snapshot...'
generateSnapshot.sh
If I run this script connected to the instance by ssh, it works, but then I tried to use it from Bamboo, and it doesn't. I used the Command task, placing my script inside the job folder, so it could be visible. And I also used the Script task, pasting that code in the "script body" field, but both ways didn't work.
It is wierd because the log doesn't show the echo messages that I added to the script. Is this normal? Do you know how could I make this script work?
Thank you very much.