]> git.pld-linux.org Git - packages/gitlab-workhorse.git/blob - gitlab-workhorse.init
configurable listen options
[packages/gitlab-workhorse.git] / gitlab-workhorse.init
1 #!/bin/sh
2 #
3 # gitlab-workhorse GitLab Workhorse
4 #
5 # chkconfig:    345 82 18
6 # description: Runs GitLab Workhorse
7 # processname: gitlab-workhorse
8
9 # Source function library
10 . /etc/rc.d/init.d/functions
11
12 # Get network config
13 . /etc/sysconfig/network
14
15 # Check that networking is up.
16 if is_yes "${NETWORKING}"; then
17         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
18                 msg_network_down "GitLab Workhorse"
19                 exit 1
20         fi
21 else
22         exit 0
23 fi
24
25 ### Environment variables
26 RAILS_ENV="production"
27
28 # The username and path to the gitlab source
29 USER=git
30 APP_PATH=/usr/lib/gitlab
31
32 # The PID and LOCK files
33 pidfile=/var/run/gitlab/gitlab-workhorse.pid
34 lockfile=/var/lock/subsys/gitlab-workhorse
35
36 # Get service config - may override defaults
37 [ -f /etc/sysconfig/gitlab-workhorse ] && . /etc/sysconfig/gitlab-workhorse
38
39 start() {
40         # Check if the service is already running?
41         if [ -f $lockfile ]; then
42                 msg_already_running "GitLab Workhorse"
43                 return
44         fi
45
46         msg_starting "GitLab Workhorse"
47         # initlog would cause fd1 and fd2 to be pipe
48         # those won't exist when workhorse tries to write to stdout causing it to abort with SIGPIPE
49         # http://lists.pld-linux.org/mailman/pipermail/pld-devel-en/2016-September/025111.html
50         RC_LOGGING=no
51         daemon --pidfile $pidfile --user $USER --makepid --chdir "$APP_PATH" --redirfds --fork \
52                 /usr/sbin/gitlab-workhorse $OPTIONS $LISTEN_OPTIONS
53         RETVAL=$?
54         [ $RETVAL -eq 0 ] && touch $lockfile
55 }
56
57 stop() {
58         if [ ! -f $lockfile ]; then
59                 msg_not_running "GitLab Workhorse"
60                 return
61         fi
62
63         # Stop daemons.
64         msg_stopping "GitLab Workhorse"
65         killproc --pidfile $pidfile gitlab-workhorse
66         RETVAL=$?
67         rm -f $lockfile
68 }
69
70 condrestart() {
71         if [ ! -f $lockfile ]; then
72                 msg_not_running "GitLab Workhorse"
73                 RETVAL=$1
74                 return
75         fi
76
77         stop
78         start
79 }
80
81 RETVAL=0
82 # See how we were called.
83 case "$1" in
84   start)
85         start
86         ;;
87   stop)
88         stop
89         ;;
90   restart)
91         stop
92         start
93         ;;
94   try-restart)
95         condrestart 0
96         ;;
97   force-reload)
98         condrestart 7
99         ;;
100   status)
101         status --pidfile $pidfile gitlab-workhorse
102         RETVAL=$?
103         ;;
104   *)
105         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
106         exit 3
107 esac
108
109 exit $RETVAL
This page took 0.061814 seconds and 3 git commands to generate.