-
-
Save redliu312/4a958c6c14af69b6dd566b42ca413300 to your computer and use it in GitHub Desktop.
Git Daemon start/stop file for /etc/init.d and services (CentOS)
This file contains hidden or 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=gitdaemon | |
GROUP=git | |
BASE_PATH=/opt/gitrepo/ | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment