Subversion (SVN) Server Startup Script
February 12th, 2008
1 comment
To be able to start and stop my subversion server nicely I created the following script to startup and shutdown under debian.
#! /bin/sh # /etc/init.d/svnserve: start and stop svnserve # Exit immediately if a command exits with a nonzero exit status. set -e # svnserve exists and is executable test -x /usr/bin/svnserve || exit 0 # Directory Where the Repository is located, created with svnadmin create REPOS_DIR="/opt/svn" # The pid-file PIDFILE="/var/run/svnserve.pid" case "$1" in start) echo -n "Starting Subversion (SVN) Server" start-stop-daemon --start --quiet \ --exec /usr/bin/svnserve -- -dr $REPOS_DIR # Also tried the following line but it didn't work ok # --make-pidfile --pidfile $PIDFILE PID=`pidof svnserve` || true echo $PID > $PIDFILE echo "." ;; stop) echo -n "Stopping Subversion (SVN) Server" start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE if [ -f $PIDFILE ] then rm $PIDFILE fi echo "." ;; *) echo "Usage: /etc/init.d/svnserve {start|stop}" exit 1 esac exit 0
Place the script in /etc/init.d/svnserve and run the following command:
update-rc.d svnserve defaults