diff options
author | Max Rees <maxcrees@me.com> | 2020-06-15 01:10:53 -0500 |
---|---|---|
committer | Max Rees <maxcrees@me.com> | 2020-06-15 01:10:53 -0500 |
commit | 7205748706663099aa36c06aa0c243cb1632db3d (patch) | |
tree | d4417c3cf1634d8b90b11c7deda25335745e5344 /user/gitlab-runner/gitlab-runner.initd | |
parent | 4e53c51f591cbd62817c797c10d240c008182ab3 (diff) | |
download | packages-7205748706663099aa36c06aa0c243cb1632db3d.tar.gz packages-7205748706663099aa36c06aa0c243cb1632db3d.tar.bz2 packages-7205748706663099aa36c06aa0c243cb1632db3d.tar.xz packages-7205748706663099aa36c06aa0c243cb1632db3d.zip |
user/gitlab-runner: new package
Diffstat (limited to 'user/gitlab-runner/gitlab-runner.initd')
-rw-r--r-- | user/gitlab-runner/gitlab-runner.initd | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/user/gitlab-runner/gitlab-runner.initd b/user/gitlab-runner/gitlab-runner.initd new file mode 100644 index 000000000..1fc47410c --- /dev/null +++ b/user/gitlab-runner/gitlab-runner.initd @@ -0,0 +1,45 @@ +#!/sbin/openrc-run + +: "${CONFIG_FILE:=/etc/gitlab-runner/config.toml}" +: "${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 +} |