Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Has any one got a init script for the svn service lying around that works?

Thanks

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Here is what i cooked up. note my svn directory is on the root folder /svn

#!/bin/bash
#
#   /etc/rc.d/init.d/subversion
#
# Starts the Subversion Daemon
#
# chkconfig: 2345 90 10
# description: Subversion Daemon

# processname: svnserve

. /etc/rc.d/init.d/functions

[ -x /usr/bin/svnserve ] || exit 1

RETVAL=0
prog="svnserve"
desc="Subversion Daemon"

start() {
        echo -n $"Starting $desc ($prog): "
   daemon $prog -r /svn -d
   RETVAL=$?
   [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
   echo
}

stop() {
   echo -n $"Shutting down $desc ($prog): "
   killproc $prog
   RETVAL=$?
   [ $RETVAL -eq 0 ] && success || failure
   echo
   [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
   return $RETVAL
}

case "$1" in
  start)
   start
   ;;
  stop)
   stop
   ;;
  restart)
   stop
   start
   RETVAL=$?
   ;;
  condrestart)
        [ -e /var/lock/subsys/$prog ] && restart
   RETVAL=$?
   ;;
  *)
   echo $"Usage: $0 {start|stop|restart|condrestart}"
   RETVAL=1
esac

exit $RETVAL

Change this line to reflect your directory

daemon $prog -r /svn -denter code here

Then run in shell

#chkconfig --add svnserve
#chkconfig svnserve on

Restart the service to see if it works

#service svnserve restart

and boom :D

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.