Skip to content

Instantly share code, notes, and snippets.

@maca
Forked from nheine/gitlab-ci-runner
Last active April 8, 2018 02:15
Show Gist options
  • Save maca/94b5d5a1a665f1089795 to your computer and use it in GitHub Desktop.
Save maca/94b5d5a1a665f1089795 to your computer and use it in GitHub Desktop.
#!/sbin/runscript
# GitLab Runner init script for Gentoo Linux
GITLAB_RUNNER_BASE=/home/runner/gitlab-runners/gitlab-ci-runner
GITLAB_RUNNER_USER=runner
depend() {
need net
}
start() {
ebegin "Starting gitlab-runner"
[[ -d ${GITLAB_RUNNER_BASE}/tmp/pids ]] || su $GITLAB_RUNNER_USER -c "mkdir -p ${GITLAB_RUNNER_BASE}/tmp/pids"
start-stop-daemon --start \
--chdir "${GITLAB_RUNNER_BASE}/" \
--user "${GITLAB_RUNNER_USER}" \
--background \
--pidfile "${GITLAB_RUNNER_BASE}/tmp/pids/runner.pid" \
--exec bundle -- exec ./bin/runner
# this does not yet create a PID file, why?
eend $?
}
stop() {
ebegin "Stopping gitlab-runner"
start-stop-daemon --stop \
--chdir "${GITLAB_RUNNER_BASE}/" \
--user "${GITLAB_RUNNER_USER}" \
--pidfile "${GITLAB_RUNNER_BASE}/tmp/pids/runner.pid"
eend $?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment