In TeamCity a build agent contains two processes:

Whether you run a build agent via the agent.bat|sh script or as a Windows service, at first the agent launcher starts and then it starts the agent.

You do not need to specify any of the options unless you are advised to do by the TeamCity support team or you know what you are doing.

In this section:

Agent Properties

For both processes above you can customize the final agent behavior by specifying system properties and variables for the agent to run with.

Build Agent Is Run Via Script

Before you run the <Agent Home>\bin\agent.bat|sh script, set the following environment variables:

Build Agent Is Run As Service

In the <Agent Home>\launcher\conf\wrapper.conf file, add the following lines (one per option):

wrapper.app.parameter.<N>
  • You should add additional lines before the following line in the wrapper.conf file:

    wrapper.app.parameter.N=jetbrains.buildServer.agent.AgentMain
  • Please ensure to re-number all the lines after the inserted ones.

Agent Launcher Properties

It's rare that you would ever need these. Most probably you would need affecting main agent process properties described above.

Build Agent Is Run Via Script

Before you run the <Agent Home>\bin\agent.bat|sh script, set the TEAMCITY_LAUNCHER_OPTS environment variable.

Build Agent Is Run As Service

In the <Agent Home>\launcher\conf\wrapper.conf file, add the following lines (one per option, the N number should increase):

wrapper.java.additional.<N>

Make sure you re-number all the lines after the inserted ones.

{hidden-data}
For example:
{code}
-Dteamcity_logs=../logs/
{code}


h2. {anchor:bothServerAgentProperties}Server and Agent Properties

|| Property Name || Description ||
| {{log4j.configuration}} | The URL of the {{log4j.xml}} file to be used for logging in TeamCity (applies both to  agent and server). For example: {code}-Dlog4j.configuration=file:../conf/teamcity-server-log4j.xml{code} |
| {{teamcity_log}} | When the default {{teamcity-(server/agent)-log4j.xml}} is used, this specifies the directory which will contain TeamCity logs. By default, it points to {{<[TeamCity Home|TeamCity Home Directory]>/logs}} or {{<TeamCity Agent home>/logs}}, respectively. |
{hidden-data}


See also:

Concepts: Agent Home Directory
Administrator's Guide: Configuring TeamCity Server Startup Properties