Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How should I start a Windows Runner without needing to keep the host terminal open?

Gabe Klavans May 2, 2023

After following the instructions to start up a Windows runner, I noticed that the `start.ps1` script runs in the foreground, and ends if I close the terminal session that started it. I'd like to be able to start this script without needing to keep the terminal open, more specifically to start it over SSH. 

What is the recommended way to do this? I've tried using `Start-Job` in Powershell 7.3.4, but I get the following error:

OpenError: [localhost] There is an error processing data from the background process. Error reported: [2023-05-02 16:08:53,453] Runner version: 1.463.

2 answers

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 4, 2023

Hello @Gabe Klavans ,

Just adding to @Erez Maadani response, currently Windows runners are not natively packaged to run as a Windows service, and we do have a feature request to implement this functionality : 

I would encourage you to add your vote to that ticket and also mark yourself as a watcher to receive first-hand updates.

While that feature is not implemented, you can make use of a third-party WinSW wrapper to encapsulate the runner script and run it as a Windows service. You can find detailed instructions on how to achieve that in the below article : 

By using the service wrapper, you will not be required to keep the user session alive on the host, as the runner will be executed in the background. You can try to follow the instructions in that article and let us know how it goes.

Thank you, @Gabe Klavans !

Patrik S

Gabe Klavans May 5, 2023

Awesome, thank you for the article. I'll try it out.

Gabe Klavans June 2, 2023

The steps were fairly simple and work great! I did have to make sure my machine-wide script execution policy was set to Unsigned so the runner could clone the repo, but that was straight-forward enough from the pipeline execution errors.

Thanks again

0 votes
Erez Maadani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 2, 2023
Gabe Klavans May 2, 2023

Yeah I did see that post. It looks pretty manual, basically bypassing Atlassian’s script. I figured there would be some way recommended by Atlassian themselves to do this considering it’s kind of a huge wall to have to keep a session alive for as long as you want the runner to stay up over SSH, or need graphical access to spawn a terminal to keep it up.

But I suppose I can follow that method if things get cumbersome enough.

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events