Skip to content

Instantly share code, notes, and snippets.

@dexterbt1
Created April 6, 2011 13:15
Show Gist options
  • Save dexterbt1/905615 to your computer and use it in GitHub Desktop.
Save dexterbt1/905615 to your computer and use it in GitHub Desktop.
svnserve init script (tested on CentOS/RHEL 5.x)
#!/bin/bash
#
# /etc/init.d/subversion
#
# Starts the Subversion Daemon
#
# chkconfig: 2345 90 10
# description: Subversion Daemon
# copied from http://www.svnforum.org/threads/31170-init.d-script-for-fedora-redhat
# processname: svnserve
source /etc/rc.d/init.d/functions
[ -x /usr/bin/svnserve ] || exit 1
### Default variables
SYSCONFIG="/etc/sysconfig/subversion"
### Read configuration
[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"
RETVAL=0
prog="svnserve"
desc="Subversion Daemon"
start() {
echo -n $"Starting $desc ($prog): "
daemon --user $USER $prog -d $OPTIONS
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment