Skip to content

Instantly share code, notes, and snippets.

@lukehutton
Created March 11, 2014 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukehutton/9477210 to your computer and use it in GitHub Desktop.
Save lukehutton/9477210 to your computer and use it in GitHub Desktop.
TeamCity Build Agent Start Script
#! /bin/sh
# /etc/init.d/teamcity-agent
# Common parameters, do not edit:
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="TeamCity Agent"
NAME=teamcity-agent
SCRIPTNAME=/etc/init.d/$NAME
#
# User specific parameters:
USERNAME=teamcity
GROUP=teamcity
AGENT_HOME=~$USERNAME/agent
#
. /lib/init/vars.sh
. /lib/lsb/init-functions
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
sudo -H -u $USERNAME /bin/bash --login -c "$AGENT_HOME/bin/agent.sh start"
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
sudo -H -u $USERNAME /bin/bash --login -c "$AGENT_HOME/bin/agent.sh stop"
;;
*)
echo "Usage: $SCRIPTNAME {start|stop}" >&2
exit 3
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment