Help Center

Using Agent Tags

Agent tags can be used in Distribution, Consolidation and Script jobs to automise part of setup and make it more flexible. 

By default agents have two tags already set up, AGENT_NAME and AGENT_ID. These tags can be viewed and edited in Agents tab -> Edit tags. Tag names are allowed only in upper case - when creating and using them, tag values can be any case. No spaces are allowed, use underscore (_) instead.

There are two places in Resilio Connect to use agent tags: when writing a script and when specifying directory paths. 


Using tag in commands and scripts 

Using tags in scrips is similar to using variables. Tags can be used in expressions and output. Default sample of using tags in commands in echoing job results into the log file. When specifying the command, tag prefix TAG_ shall be used. On Windows the correct syntax for using a tag is %TAG_AGENT_NAME%, on Unix that will be $TAG_AGENT_NAME. The correct syntax of the command itself depends on the system. 

In this example script will remove the directory after job's completion from Source agent on Windows. Before creating this job, create new tag AGENT_ROLE with value SRC for the relevant agents. 



Using tags in paths 

One of the use cases is to distribute/consolidate files and organise them into the relevant subfolders.

Create a new tag on Agents tab, give it a name and value. Value can be either absolute or relative path (just a subfolder). When using tags in path, tag prefix SRC or DST are required. When specifying the path upon job creation use the created tag as %SRC:TAG_NAME% or %DST:TAG_NAME%. These prefixes will resolve the tag into the path for source or destination agents accordingly.

Default sample is using "%SRC:AGENT_NAME%" tag in destination group path for Consolidation job. That tag means that destination agents will be arranging the files into subfolder per source agent name. 

Another example is using tags in Distribution jobs. For example, on source server there is a directory with subfolders (A, B, C) each of which is destined for a specific agent. We can add a tag CLIENT with values A, B, C for the corresponding agent. When creating a job, at Path step, pick the path and use the CLIENT tag with DST prefix, which basically means that destination agent with tag CLIENT = A will receive content of C:\Document\Files\A directory: 


Was the article helpful? Yes / No, send feedback on article Thanks!

Please note that we won't mail you back. This is just purely feedback on the article above. If you need help from our Support Team, please use the "Contact Support" link at the top of the page.