#!/bin/sh # # svnserve This shell script takes care of starting and stopping svnserve. # # chkconfig: 2345 80 30 # description: svnserve is a subversion server # # processname: svnserve # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Source svnserve configureation. [ -f /etc/sysconfig/svnserve ] && . /etc/sysconfig/svnserve # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then msg_network_down svnserve exit 1 fi else exit 0 fi start() { # Start daemons. if [ -f /var/lock/subsys/svnserve ]; then msg_already_running svnserve return fi msg_starting svnserve daemon --user svn svnserve ${SVNSERVE_OPTIONS} -r ${SVNSERVE_PATH} RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/svnserve } stop() { # Stop daemons. if [ ! -f /var/lock/subsys/svnserve ]; then msg_not_running svnserve return fi msg_stopping svnserve killproc svnserve rm -f /var/lock/subsys/svnserve >/dev/null 2>&1 } condrestart() { if [ ! -f /var/lock/subsys/svnserve ]; then msg_not_running svnserve RETVAL=$1 return fi stop start } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; try-restart) condrestart 0 ;; force-reload) condrestart 7 ;; status) status svnserve exit $? ;; *) msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" exit 3 esac exit $RETVAL