]> git.pld-linux.org Git - packages/gitlab-runner.git/blobdiff - gitlab-ci-multi-runner.init
fix using external prebuilt image
[packages/gitlab-runner.git] / gitlab-ci-multi-runner.init
index 13b04b8eba608c90225d9367b7e7618057de55dc..e54cab868dede0a3c763f5df3ff1e793169b6eca 100755 (executable)
@@ -14,7 +14,7 @@ USER="gitlab-runner"
 GROUP="gitlab-runner"
 CHDIR="/var/lib/gitlab-runner"
 NAME="gitlab-ci-multi-runner"
-DAEMON="/usr/bin/gitlab-ci-multi-runner"
+DAEMON="/usr/bin/gitlab-runner"
 PIDFILE="/var/run/gitlab-ci-multi-runner.pid"
 LOGFILE="/var/log/gitlab-ci-multi-runner.log"
 
@@ -35,6 +35,14 @@ do_stop() {
        start-stop-daemon --stop --pidfile "$PIDFILE" --user "$USER" --exec "$DAEMON" --quiet
 }
 
+okfail() {
+       if [ "$1" = 0 ]; then
+               ok
+       else
+               fail
+       fi
+}
+
 start() {
        # Check if the service is already running?
        if [ -f /var/lock/subsys/$NAME ]; then
@@ -45,6 +53,7 @@ start() {
        msg_starting "$DESC"
        do_start
        RETVAL=$?
+       okfail $RETVAL
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
 }
 
@@ -57,6 +66,7 @@ stop() {
        # Stop daemons.
        msg_stopping "$DESC"
        do_stop
+       okfail $?
        rm -f /var/lock/subsys/$NAME
 }
 
@@ -71,6 +81,11 @@ condrestart() {
        start
 }
 
+# run gitlab-runner register with proper uid/gid
+register() {
+       runuser -u "$USER" -g "$GROUP" gitlab-runner "$@"
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
@@ -90,12 +105,15 @@ case "$1" in
   force-reload)
        condrestart 7
        ;;
+  register)
+       register "$@"
+       ;;
   status)
        status --pidfile $PIDFILE $NAME
        RETVAL=$?
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|register|status}"
        exit 3
 esac
 
This page took 0.070876 seconds and 4 git commands to generate.