-
-
Save rofrol/e6169cd776919da8078c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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