Skip to content

Instantly share code, notes, and snippets.

@kwoods
Created May 9, 2016 16:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwoods/5756cae6a6e47774ce97de3a7f0d8b38 to your computer and use it in GitHub Desktop.
Save kwoods/5756cae6a6e47774ce97de3a7f0d8b38 to your computer and use it in GitHub Desktop.
TeamCity Build Agent - Systemd service
[Unit]
Description=TeamCity Build Agent
After=network.target
[Service]
Type=forking
PIDFile=$AGENT_HOME/logs/buildAgent.pid
ExecStart=/usr/bin/sudo -u teamcity $AGENT_HOME/bin/agent.sh start
ExecStop=/usr/bin/sudo -u teamcity $AGENT_HOME/bin/agent.sh stop
[Install]
WantedBy=multi-user.target
@erikhugintech
Copy link

Within the [Service] section:

  • Don't use sudo. Use User=teamcity and Group=teamcity
  • Set KillMode=process if you want agent autoupgrade to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment