Monday, December 29, 2008

simple svnserve script

I wanted to shutdown or stop svnserve properly: Easy if you start it correctly... The following lines are a very basic scripts to have in /etc/init.d/svnserve
#!/bin/sh
case "$1" in
    start)
      svnserve -d -r /srv/svn/repos --pid-file /srv/svn/svnserve.pid
      ;;
    stop)
      kill -9 `cat /srv/svn/svnserve.pid`
      ;;
    restart)
      $0 start
      $0 stop
      ;;
    *)
      echo "Usage: /etc/init.d/svnserve {start|stop|restart}"
      exit 1
      ;;
esac
exit 0
As i said, this is vey basic, checking for the "/srv/svn/svnserve.pid" file could be added and deleting it would be also fine. Anyhow, this seems enought for now.

No comments: