I've installed a runner on my linux instance, but it will only work while I am ssh'd into the machine. If I close my terminal session, the runner no longer works. How can I have the runner always running?
Hello @ryanjmp and welcome to the Community!
If you are referring to Linux Shell runners, you can run it as a service/daemon by configuring the runner in systems. Systemd service will run in the background and will not require your session to be active. It will also automatically start the runner service when the host is booted.
Following are the instructions on how to configure it :
sudo nano /lib/systemd/system/bitbucketrunner.service
[Unit]
Description=Bitbucket Runner Service
[Service]
WorkingDirectory=/home/ubuntu/atlassian-bitbucket-pipelines-runner/bin/
ExecStart=/home/ubuntu/atlassian-bitbucket-pipelines-runner/bin/start.sh --accountUuid {REDACTED} --repositoryUuid {REDACTED} --runnerUuid {REDACTED} --OAuthClientId REDACTED --OAuthClientSecret REDACTED --runtime linux-shell --workingDirectory ../temp
[Install]
WantedBy=multi-user.target
where :
WorkingDirectory : the absolute path to bin folder where you extracted the runner in the host.sudo systemctl daemon-reload
Whenever you make any changes to the .service file, you will need to reload the daemon for the changes to take effect.sudo systemctl enable bitbucketrunner.service
sudo systemctl start bitbucketrunner.service
sudo systemctl status bitbucketrunner.service
If the service status reports that the runner started successfully, you can check the runner state in the UI as it should be showing as Online already, which means it's ready to run your pipelines :)
Hope that helps! If you have any questions, feel free to ask.
Thank you, @ryanjmp !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.