3 # gitlab-runner GitLab Runner
6 # description: Enables automatic start of runners at boot time in the background
7 # processname: gitlab-runner
9 # Source function library
10 . /etc/rc.d/init.d/functions
15 CHDIR="/var/lib/gitlab-runner"
17 DAEMON="/usr/bin/gitlab-runner"
18 PIDFILE="/var/run/gitlab-runner.pid"
19 LOGFILE="/var/log/gitlab-runner.log"
21 # Read configuration variable file if it is present
22 [ -f /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
25 start-stop-daemon --start \
26 --pidfile "$PIDFILE" \
30 --chuid "$USER:$GROUP" \
31 --exec "$DAEMON" -- "run" >> $LOGFILE 2>&1
35 start-stop-daemon --stop --pidfile "$PIDFILE" --user "$USER" --exec "$DAEMON" --quiet
47 # Check if the service is already running?
48 if [ -f /var/lock/subsys/$NAME ]; then
49 msg_already_running "$DESC"
57 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
61 if [ ! -f /var/lock/subsys/$NAME ]; then
62 msg_not_running "$DESC"
70 rm -f /var/lock/subsys/$NAME
74 if [ ! -f /var/lock/subsys/$NAME ]; then
75 msg_not_running "$DESC"
84 # run gitlab-runner register with proper uid/gid
86 runuser -u "$USER" -g "$GROUP" gitlab-runner "$@"
90 # See how we were called.
112 status --pidfile $PIDFILE $NAME
116 msg_usage "$0 {start|stop|restart|try-restart|force-reload|register|status}"