blob: a5f65dacb28ea1f4d7fa56b0f4c1f6f0d2ec13d1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#!/sbin/openrc-run
: "${CONFIG_FILE:=/etc/gitlab-runner/config.toml}"
: "${command_args:=--working-directory /var/lib/gitlab-runner}"
: "${logfile:=/var/log/gitlab-runner.log}"
: "${timeout:=300}"
: "${retry:=60}"
: "${command_user:=gitlab-runner:gitlab-runner}"
export CONFIG_FILE
command="/usr/bin/gitlab-runner"
command_args="run --service ${RC_SVCNAME} ${command_args}"
command_background="true"
start_stop_daemon_args="--stdout ${logfile} --stderr ${logfile}"
pidfile="/run/${RC_SVCNAME}.pid"
extra_started_commands="reload gracefulstop"
description_reload="Reload configuration"
description_gracefulstop="Finish current jobs, then stop"
start_pre() {
checkpath -f -m 640 -o "${command_user}" "${logfile}"
}
reload() {
ebegin "Reloading ${RC_SVCNAME} configuration"
start-stop-daemon --quiet --signal HUP --pidfile "${pidfile}"
eend $?
}
gracefulstop() {
ebegin "Gracefully stopping ${RC_SVCNAME}"
mark_service_stopping "${RC_SERVICE}"
start-stop-daemon --quiet --progress --stop --pidfile "${pidfile}" \
--signal QUIT --retry "${timeout}"
if eend $?; then
mark_service_stopped "${RC_SVCNAME}"
else
eerror "${RC_SVCNAME} timed out, forcefully stopping"
if stop; then
mark_service_stopped "${RC_SVCNAME}"
else
return 1
fi
fi
}
|