How to restart gitlab runner safely?

Sometimes I need to restart gitlab runner v11.0.2. But I don’t know wether it is running a job.
If it is running a job, I restart it, the job will show “ERROR: Job failed (system failure): aborted: terminated” for me.
I have tried use docker ps command to check wether there is running docker container, but when gitlab runner start a job, maybe it does not create a docker container yet.
So, How to restart gitlab runner safely?

2 Likes

Using the api you can determine if there is a job running before restarting your runner.
I also would have wished a reload command or be able to reload the config with the HUP signal without killing the current jobs but seems not to be on the radar yet…

More info here: Runners API | GitLab