Debian GNU Linux/4.0 etch/mongrel のバックアップ(No.1)


Debian GNU Linux 4.0 eath - mongrel

/etc/init.d/svnserve

#!/bin/sh
#
# Startup script for Subversion Server
#

set -e


# ----- Save and Set Environment Variables --------------------------------

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON="/usr/bin/svnserve"
NAME=svnserve
DESC="Subversion server daemon"
USER=svn
GROUP=svn
REPOSITORY=/var/svn/
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

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


# ----- Define Function ---------------------------------------------------

start() {
  start-stop-daemon --start --quiet --pidfile $PIDFILE \
          --user $USER --group $GROUP --exec $DAEMON -- -r $REPOSITORY -d
  if [ "$?" -eq 0 ]; then
    pidof $DAEMON > $PIDFILE
  fi
}

stop() {
  start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
  rm -f $PIDFILE
}

wait() {
  sleep 1
}


# ----- Execute The Requested Command -------------------------------------
case "$1" in
  start)
    echo -n "Starting $DESC: $NAME"
    start
    echo "."
    ;;
  stop)
    echo -n "Stopping $DESC: $NAME"
    stop
    echo "."
    ;;
  restart|force-reload)
    echo -n "Restarting $DESC: $NAME"
    stop
    wait
    start
    echo "."
    ;;
  *)
    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0


関連ページ