Skip to content

Instantly share code, notes, and snippets.

@zingmars
Created January 20, 2017 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zingmars/59f9c3abd925f24c14683e60f020cdf1 to your computer and use it in GitHub Desktop.
Save zingmars/59f9c3abd925f24c14683e60f020cdf1 to your computer and use it in GitHub Desktop.
gitlab-runner's Gentoo init.rc script
# to add to startup simply run rc-update add gitlab-runner default
# this script assumes you installed the runner in /usr/bin.
#!/sbin/openrc-run
PIDFILE="/var/run/gitlab-ci-multi-runner.pid"
DAEMON="/usr/bin/gitlab-ci-multi-runner"
LOGFILE="/var/log/gitlab-ci-multi-runner.log"
USER="gitlab-runner"
GROUP="gitlab-runner"
extra_commands="update"
start() {
ebegin "Starting gitlab-runner"
start-stop-daemon --start --exec /usr/bin/gitlab-ci-multi-runner --pidfile "$PIDFILE" --chdir "/home/$USER" --background --make-pidfile --exec "$DAEMON" -- run &>> $LOGFILE
eend $?
}
stop() {
ebegin "Stopping gitlab-runner"
start-stop-daemon --stop --pidfile "$PIDFILE" --user "$USER" --exec "$DAEMON" --quiet
eend $?
}
update() {
stop
ebegin "Updating gitlab-runner"
wget -O /usr/bin/gitlab-ci-multi-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-linux-amd64
start
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment