github.com/secure-build/gitlab-runner@v12.5.0+incompatible/docs/configuration/init.md (about) 1 # The system services of GitLab Runner 2 3 GitLab Runner uses the [Go `service` library](https://github.com/kardianos/service) 4 to detect the underlying OS and eventually install the service file based on 5 the init system. 6 7 NOTE: **Note:** 8 `service` will install / un-install, start / stop, and run a program as a 9 service (daemon). Currently supports Windows XP+, Linux/(systemd | Upstart | SysV), 10 and macOS/Launchd. 11 12 Once GitLab Runner [is installed](../install/index.md), the service file will 13 be automatically be created: 14 15 - **systemd:** `/etc/systemd/system/gitlab-runner.service` 16 - **upstart:** `/etc/init/gitlab-runner` 17 18 ## Overriding the default service files 19 20 In some cases, you might want to override the default behavior of the service. 21 22 For example, when upgrading the Runner, you'll want it to stop gracefully 23 until all running jobs are finished, but systemd, upstart, or some other service 24 may almost immediately restart the process without even noticing. 25 26 So, when upgrading the Runner, the installation script will kill and restart 27 the Runner's process which would most probably be handling some new jobs at 28 that time. 29 30 ### Overriding systemd 31 32 For Runners that use systemd create 33 `/etc/systemd/system/gitlab-runner.service.d/kill.conf` with the following 34 content: 35 36 ```bash 37 [Service] 38 TimeoutStopSec=7200 39 KillSignal=SIGQUIT 40 ``` 41 42 After adding these two settings to the systemd unit configuration, you can 43 stop the Runner and systemd will use `SIGQUIT` as the kill signal, to stop the 44 process. Additionally, a 2h timeout is set for the stop command, which 45 means that if any jobs don't terminate gracefully before this timeout, systemd 46 will just `SIGKILL` the process. 47 48 ### Overriding upstart 49 50 For Runners that use upstart create `/etc/init/gitlab-runner.override` with the 51 following content: 52 53 ```bash 54 kill signal SIGQUIT 55 kill timeout 7200 56 ``` 57 58 After adding these two settings to the upstart unit configuration, you can 59 stop the Runner and upstart will do exactly the same as systemd above.