Skip to content

Instantly share code, notes, and snippets.

@agushuley
Forked from yatesr/bamboo-agent
Last active December 9, 2015 10:12
Show Gist options
  • Save agushuley/147fe36a7a2352dcadf3 to your computer and use it in GitHub Desktop.
Save agushuley/147fe36a7a2352dcadf3 to your computer and use it in GitHub Desktop.
Init script for starting/stopping a bamboo agent
#!/bin/bash
# bamboo-agent Init script for running bamboo agent
#
# chkconfig: 2345 98 02
#
# description: Starts and stops bamboo agent
# This is just a delegator to the Bamboo agent script.
USER=apps
AGENTS_HOME=/opt/local/bamboo-agents
if [[ "$EUID" != '0' ]]; then
echo 'This script must be run as root!'
exit 1
fi
agents=$( su - ${USER} -c "eval ls ${AGENTS_HOME}/*/bin/bamboo-agent.sh" ) || {
exit $?
}
for agent in $agents; do
echo "Running $agent $*"
su - ${USER} -c "$agent $*"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment