about summary refs log tree commit diff stats
path: root/tools/conf/etc/rc.d/git-daemon
diff options
context:
space:
mode:
authorSilvino Silva <silvino@bk.ru>2017-03-01 21:27:03 +0000
committerSilvino Silva <silvino@bk.ru>2017-05-13 16:40:44 +0100
commit079066bc153f3a6fe84b5da0b8fa8e584641b46d (patch)
tree5ed282dccdd6b8004a86f9c765843f0f5852f9c9 /tools/conf/etc/rc.d/git-daemon
parent40fc398cab05e1ae769554a50fb423ca38c3bfb6 (diff)
downloaddoc-079066bc153f3a6fe84b5da0b8fa8e584641b46d.tar.gz
overall revision
Diffstat (limited to 'tools/conf/etc/rc.d/git-daemon')
-rwxr-xr-xtools/conf/etc/rc.d/git-daemon42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/conf/etc/rc.d/git-daemon b/tools/conf/etc/rc.d/git-daemon
new file mode 100755
index 0000000..8aa9d81
--- /dev/null
+++ b/tools/conf/etc/rc.d/git-daemon
@@ -0,0 +1,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