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" \
29 --chuid "$USER:$GROUP" \
30 --exec "$DAEMON" -- "run" >> $LOGFILE 2>&1 &
34 start-stop-daemon --stop --pidfile "$PIDFILE" --user "$USER" --exec "$DAEMON" --quiet
46 # Check if the service is already running?
47 if [ -f /var/lock/subsys/$NAME ]; then
48 msg_already_running "$DESC"
56 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
60 if [ ! -f /var/lock/subsys/$NAME ]; then
61 msg_not_running "$DESC"
69 rm -f /var/lock/subsys/$NAME
73 if [ ! -f /var/lock/subsys/$NAME ]; then
74 msg_not_running "$DESC"
83 # run gitlab-runner register with proper uid/gid
85 runuser -u "$USER" -g "$GROUP" gitlab-runner "$@"
89 # See how we were called.
111 status --pidfile $PIDFILE $NAME
115 msg_usage "$0 {start|stop|restart|try-restart|force-reload|register|status}"