Debian GNU Linux/3.1 sarge/Subversion のバックアップ(No.2)


Debian/Subversion

/etc/init.d/svnserve

#! /bin/sh
#
# svnserve
#

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON="/usr/bin/svnserve"
NAME=svnserve
DESC="Subversion server daemon"

PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
        start-stop-daemon --start --quiet --pidfile $PIDFILE \
                --user svn --group src --exec $DAEMON -- -r /var/data/svn/ -d
        if [ "$?" -eq 0 ]
        then
            pidof $DAEMON > $PIDFILE
        fi
        echo "."
        ;;
  stop)
        echo -n "Stopping $DESC: $NAME"
        start-stop-daemon --stop --quiet --pidfile $PIDFILE \
                --exec $DAEMON
        rm -f $PIDFILE
        echo "."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: $NAME"
        start-stop-daemon --stop --quiet --oknodo --pidfile \
                $PIDFILE --exec $DAEMON
        rm -f $PIDFILE
        sleep 1
        start-stop-daemon --start --quiet --pidfile \
                 $PIDFILE --user svn --group src --exec $DAEMON -- -r /var/data/svn/ -d
        if [ "$?" -eq 0 ]
        then
            pidof $DAEMON > $PIDFILE
        fi
        echo "."
        ;;
  *)
        # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0