Skip to content

Instantly share code, notes, and snippets.

@zingmars
Created January 20, 2017 21:31
Show Gist options
  • Select an option

  • Save zingmars/59f9c3abd925f24c14683e60f020cdf1 to your computer and use it in GitHub Desktop.

Select an option

Save zingmars/59f9c3abd925f24c14683e60f020cdf1 to your computer and use it in GitHub Desktop.

Revisions

  1. zingmars created this gist Jan 20, 2017.
    31 changes: 31 additions & 0 deletions gitlab-runner.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    # 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
    }