Skip to content

Instantly share code, notes, and snippets.

@xymor
Created June 25, 2012 19:04
Show Gist options
  • Save xymor/2990558 to your computer and use it in GitHub Desktop.
Save xymor/2990558 to your computer and use it in GitHub Desktop.
git-daemon start script
#!/bin/sh
#
# From: http://robescriva.com/blog/2009/01/13/git-daemon-init-scripts-on-centos-52/
# Startup/shutdown script for Git Daemon
#
# Linux chkconfig stuff:
#
# chkconfig: 345 56 10
# description: Startup/shutdown script for Git Daemon
#
. /etc/init.d/functions
DAEMON=/usr/bin/git
ARGS='daemon --reuseaddr --base-path=/home/ec2-user/git/ --detach --user=ec2-user --group=ec2-user'
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment