Skip to content

Instantly share code, notes, and snippets.

@nheine
Created November 4, 2013 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nheine/7298564 to your computer and use it in GitHub Desktop.
Save nheine/7298564 to your computer and use it in GitHub Desktop.
gitlab-ci-runner
#!/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