blob: 8aa9d819192be4778f87b06b958d97278bd164f6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/bin/sh
SSD=/sbin/start-stop-daemon
NAME=git-daemon
PROG=$(git --exec-path)/${NAME}
USER=www
GROUP=www
PIDFILE=/var/run/git-daemon.pid
OPTS="--verbose --reuseaddr --base-path=/srv/gitolite/repositories"
case $1 in
start)
echo "Starting ${NAME}..."
$SSD --start \
--pidfile ${PIDFILE} \
--exec ${PROG} -- ${OPTS} \
--detach --pid-file=${PIDFILE} \
--user=${USER} --group=${GROUP}
;;
stop)
echo "Stopping ${NAME}..."
$SSD --stop --quiet --name git-daemon \
--pidfile ${PIDFILE}
;;
restart)
echo "Restarting ${NAME}..."
$0 stop
$0 start
;;
status)
$SSD --status --pidfile $PIDFILE
case $? in
0) echo "$PROG is running with pid $(cat $PIDFILE )" ;;
3) echo "$PROG is not running" ;;
4) echo "Unable to determine the program status" ;;
esac
;;
*)
echo "usage: $0 [start|stop|restart|status]"
;;
esac
|