Unable to run script in Bamboo agent

Hello,

Recently I configured my agent to run once a day on RHEL 6.5. The agent is supposed to execute a script in /opt/automated_testing/hl_script.sh. My problem is that when I run this script, it's supposed to create a logs directory in the same location of /opt/automated_testing (it has write permissions in that location.) However, this directory is not created... when I run the script itself I see some of the default output (that normally gets forwarded to the console.)

Ok, weird. Then I create a test.sh in the same directory and set it up to execute just this "touch foo.txt". I have the shebang "#!/bin/sh" at the top and all of the scripts are executable to the user (which is also how the bamboo proc is started as.)

What am I doing wrong?

2 answers

1 accepted

This widget could not be displayed.

Hi Andrew,

If your /opt/automated_testing/hl_script.sh has the following content:

#!/bin/sh

# create a new directory
mkdir logs

# create a new log file
touch logs/foo.txt

The script above will generate its output under <bamboo-home>/xml-data/build-dir/

In case you decide on having them created under the same directory as your running script (/opt/automated_testing/), you should append the full path to your commands as per following:

#!/bin/sh

# create a new directory
mkdir /opt/automated_testing/logs

# create a new log file
touch /opt/automated_testing/foo.txt

The script above will generate its output under /opt/automated_testing

Kind regards,
Rafael

This widget could not be displayed.

Hi Rafael,

This was due to me not realizing that I was running the script in a different directory entirely. Thanks for your help.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Friday in Bitbucket

What is your #1 piece of advice to new users getting started using Bitbucket?

Hello Community! My name is Claire Maynard, and I’m a Product Marketing Manager on the Bitbucket team. I’m interested in hearing what advice or tips you have for new users getting started on ...

135 views 5 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you