about summary refs log tree commit diff stats
path: root/linux/conf/rc.d/git-daemon
diff options
context:
space:
mode:
authorSilvino Silva <silvino@bk.ru>2021-02-12 03:59:34 +0000
committerSilvino Silva <silvino@bk.ru>2021-02-12 03:59:34 +0000
commita3628fc49db4d88ff3e4067268650710d1da3f6f (patch)
tree8fdac6dfc8cabb9f85a2db3a3bd628cfe44438cd /linux/conf/rc.d/git-daemon
parent0a6b0fc9769daf0932cb207c3285baa31547b489 (diff)
downloaddoc-a3628fc49db4d88ff3e4067268650710d1da3f6f.tar.gz
initial openbsd support
Diffstat (limited to 'linux/conf/rc.d/git-daemon')
-rwxr-xr-xlinux/conf/rc.d/git-daemon43
1 files changed, 43 insertions, 0 deletions
diff --git a/linux/conf/rc.d/git-daemon b/linux/conf/rc.d/git-daemon
new file mode 100755
index 0000000..41793eb
--- /dev/null
+++ b/linux/conf/rc.d/git-daemon
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+SSD=/sbin/start-stop-daemon
+NAME=git-daemon
+PROG=$(git --exec-path)/${NAME}
+USER=gitolite
+GROUP=gitolite
+PIDFILE=/var/run/git-daemon.pid
+REPOS=/srv/gitolite/repositories
+OPTS="--verbose --reuseaddr --base-path=${REPOS}"
+
+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