84433568 2011-08-21
在Fedora14了安装了subversion,不想直接简单的写到启动脚本里启动,于是google到下面的脚本了,毕竟用chkconfig和service命令更方便。
本脚本能让subversion作为一个守护进程启动。
vi/etc/init.d/subversion
#!/bin/bash # # /etc/rc.d/init.d/subversion # # Starts the Subversion Daemon # # chkconfig: 2345 90 10 # description: Subversion Daemon # 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 $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
vi/etc/sysconfig/subversion
# Configuration file for the Subversion service # # To pass additional options (for instace, -r root of directory to server) to # the svnserve binary at startup, set OPTIONS here. # #OPTIONS= OPTIONS="--threads --root /var/svn"
*subversion守护进程的选项,比如'--root<版本库的路径>',可以在'/etc/sysconfig/subversion'文件里设置。
*以root帐户执行:'chmod+x'/etc/init.d/subversion'
*以root帐户执行:'chkconfig--addsubversion&&chkconfigsubversionon'
*以root帐户执行:'servicesubversionstart'