Skip to content

Instantly share code, notes, and snippets.

@knope
Forked from guifromrio/teamcity-agent-ubuntu.md
Last active October 27, 2017 12:15
Show Gist options
  • Save knope/45d6b099133c4076e017ced9a6bd8f0b to your computer and use it in GitHub Desktop.
Save knope/45d6b099133c4076e017ced9a6bd8f0b to your computer and use it in GitHub Desktop.
Instructions to Setup Teamcity Agent on EC2 Ubuntu 12.04.2 Linux with NodeJS and PhantomJS

Create the start script

sudo vim /etc/init.d/teamcity

Add the following contents:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          TeamCity autostart
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start teamcity daemon at boot time
# Description:       Enable service provided by daemon.
# /etc/init.d/teamcity -  startup script for teamcity
### END INIT INFO
 
 
#  Ensure you enter the  right  user name that  TeamCity will run  under
USER="teamcity"
 
 
export TEAMCITY_DATA_PATH="/opt/ts/.BuildServer"
 
case $1 in
 
start)
  start-stop-daemon --start  -c $USER --exec /opt/ts/bin/runAll.sh start
 ;;
stop)
  start-stop-daemon --start -c $USER  --exec  /opt/ts/bin/runAll.sh stop
 ;;
 esac
 
exit 0

Give it proper permissions:

    sudo chmod 755 /etc/init.d/teamcity

Add it to the startup process:

    sudo update-rc.d teamcity defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment