Session is set to expire at %v The session expires automatically after %v. If there are no more sessions after logging out, the agent terminates. You can extend this time using {{ if eq .os "windows" -}} echo > %agentdir%\.hold {{- else -}} touch $agentdir/.hold {{- end }} The expiry time is equal to the modification time of the .hold file with the expiry duration added. To prevent the agent from exiting after the last session is gone, also use the above command in any shell.