system-config/modules/cgit/templates/git-daemon.init.erb
Elizabeth Krumbach Joseph a6e4c8952b Swap git daemon in xinetd for service
Add git-daemon init file to /etc/init.d and make sure the service
is started.

For transition, keep the git xinetd file and service defined but
switch git service to stopped, we can remove this later.

Change-Id: I0cf02c7292496e39695b80b00cdcb82ec7a61700
2013-08-22 10:03:05 -07:00

64 lines
1.1 KiB
Plaintext

#!/bin/sh
#
# Startup/shutdown script for the git daemon
# chkconfig: 345 56 10
#
# description: Startup/shutdown script for the git daemon
#
. /etc/init.d/functions
NAME=git-daemon
USER=nobody
DAEMON=/usr/libexec/git-core/git-daemon
GIT_REPO=/var/lib/git
PORT=<%= scope.lookupvar("cgit::daemon_port") %>
ARGS="--base-path=/var/lib/git --user=$USER --export-all --syslog --detach --verbose --port=$PORT $GIT_REPO"
start () {
echo -n $"Starting $NAME: "
# start daemon
daemon $DAEMON $ARGS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/git-daemon
return $RETVAL
}
stop () {
# stop daemon
echo -n $"Stopping $NAME: "
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: $NAME {start|stop|restart|status}"
exit 3
;;
esac
exit $RETVAL