#!/bin/sh # # Startup/shutdown script for Git Daemon # chkconfig: 345 56 10 # # description: Startup/shutdown script for Git Daemon # # Taken from: https://gist.github.com/esoupy/3823712 . /etc/init.d/functions DAEMON=/usr/libexec/git-core/git-daemon USER=git-daemon GROUP=git BASE_PATH=/var/lib/git-daemon/repositories ARGS="--user=$USER --group=$GROUP --detach --base-path=$BASE_PATH" prog=git-daemon start () { echo -n $"Starting $prog: " # start daemon daemon $DAEMON $ARGS RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/git-daemon return $RETVAL } stop () { # stop daemon echo -n $"Stopping $prog: " killproc $DAEMON RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/git-daemon } restart() { stop start } case $1 in start) start ;; stop) stop ;; restart) restart ;; status) status $DAEMON RETVAL=$? ;; *) echo $"Usage: $prog {start|stop|restart|status}" exit 3 ;; esac exit $RETVAL