Skip to content

Instantly share code, notes, and snippets.

@rofrol
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rofrol/e6169cd776919da8078c to your computer and use it in GitHub Desktop.
Save rofrol/e6169cd776919da8078c to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Startup/shutdown script for Git Daemon
# chkconfig: 345 56 10
#
# description: Startup/shutdown script for Git Daemon
#
. /etc/init.d/functions
DAEMON=/usr/libexec/git-core/git-daemon
USER=git
GROUP=git
BASE_PATH=/opt/gitrepo/
ARGS="--user=$USER --group=$GROUP --detach --reuseaddr --enable=receive-pack --export-all --base-path=$BASE_PATH $BASE_PATH"
prog=git-daemon
start () {
echo -n $"Starting $prog: "
# start daemon
HOME=/home/git $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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment