Self-hoster linux shell runner stops when I logout of SSH connection on the remote host

Svetlozar Petkov July 4, 2023

When I go into the remote host that has the bitbucket linux shell runner installed after I initialize the command the runner goes online, but if I leave the SSH session or close the window from my terminal the runner goes back to offline. Any good solutions on resolving this ?

2 answers

1 accepted

0 votes
Answer accepted
Clifford July 5, 2023

Hi you need to run the command under nohup https://www.geeksforgeeks.org/nohup-command-in-linux-with-examples/

Svetlozar Petkov July 6, 2023

Thank you this worked wonderfully.

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 5, 2023

Hi @Svetlozar Petkov and welcome to the community!

There are several utilities in Linux that allow you to keep processes running after ending an SSH session.

screen is one of them and it is installed by default on some Linux distributions. You can check if it is already installed with the command

screen -v

If it isn't, you can check the following guide on how to install it on different Linux distributions:

Please note that this needs to be installed on your remote host, not on your own computer.

When screen is installed, you can start the runner with the following command:

screen <command to start runner>

Replace <command to start runner> with the preconfigured command we provide to start your runner.

Then, press Ctrl + A and then Ctrl + D

This will "detach" your screen session, but leave your process running, and you can leave your SSH session.

If you log in via SSH later, you can type screen -r to see the screen with the runner and Ctrl + A and Ctrl + D to detach again.


There are other tools as well, but I haven't tried them. You can check the answers in the following post from the ubuntu forum if you want to explore different tools:

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events