Configure Linux shell runner to stay online after SSH session ends
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
Learn how to keep your Linux Shell self-hosted runner active after disconnecting from SSH.
Environment
Linux Shell self-hosted runners in Bitbucket Pipelines
Solution
Option 1
You can configure the runner as a service. This way, the runner will also start automatically after a reboot of the remote server. Steps are provided in the following article:
Option 2
You can use utilities like screen or nohup to keep the runner process running after exiting the SSH session. These are usually pre-installed utilities in most Linux distributions.
In the following examples, replace <command to start runner> with the pre-configured command that starts the runner. This command is provided by Bitbucket when you create a new runner, and for Linux Shell runners:
1
2
./start.sh --accountUuid {<account id>} --repositoryUuid {<repository id>} --runnerUuid {<runner id>} --OAuthClientId <OAuthClient id> --OAuthClientSecret <OAuthClient secret> --runtime linux-shell --workingDirectory ../temp
Solution with screen:
In your SSH terminal, start the runner using this command:
1
screen <command to start runner>
Then, select Ctrl + A and Ctrl + D on your keyboard.
The commands will detach your screen session but leave your process running, and you can leave your SSH session.
Reconnect via SSH and type "screen -r"
to view the runner. Use Ctrl + A and Ctrl + D to detach.
Solution with nohup:
In the terminal that is running the SSH session to the remote server, start the runner with the following command:
1
nohup <command to start runner> &
You can leave the SSH session, and the runner will remain online.
Was this helpful?