1.svn服務自啓動腳本 把腳本放在/etc/init.d/下 vi /etc/rc.d/init.d/svn svn腳本內容: 01 #!/bin/bash 02 # chkconfig: - 85 15 03 # description: svn server 04 SVN_HOME=/svnroot/repos 05 if [ ! -f "/usr/bin/svnserve" ] 06 then 07 echo "svnserver startup: cannot start" 08 exit 09 fi 10 case "$1" in 11 start) 12 echo "Starting svnserve…" 13 /usr/local/svn/bin/svnserve -d --listen-port 3690 -r $SVN_HOME 14 echo "Finished!" 15 ;; 16 stop) 17 echo "Stoping svnserve…" 18 killall svnserve 19 echo "Finished!" 20 ;; 21 restart) 22 $0 stop 23 $0 start 24 25 ;; 26 *) 27 echo "Usage: svn { start | stop | restart } " 28 exit 1 29 esac 這裏請注意,不要刪除# chkconfig: - 85 15和# description: svn server,否則沒法使用chkconfig加入服務,會提示service svn does not support chkconfig. 而後執行 chmod 755 /etc/init.d/svn chkconfig --add svn chkconfig svn on 最後查看下chkconfig --list|grep svn 能夠看到svn已經加入到服務中,並已經在2345中爲on. 2.shell腳本啓動 這第2中自啓動腳本,是根據下面狀況才使用的 svnserve -d --listen-port 3690 -r /svnroot/repos/ svnserve -d --listen-port 3691 -r /svnroot/repo/ svn默認啓動端口是3690,這裏有兩個svn庫,因此當出現這樣的狀況時,上面的服務腳本只會啓動一個svn庫.因此就須要使用shell腳原本實現啓動兩個svn庫. vi /root/svn.sh svn.sh腳本內容: 1 #!/bin/bash 2 svnserve -d --listen-port 3690 -r /svnroot/repos/ 3 svnserve -d --listen-port 3691 -r /svnroot/repo/ 而後添加可執行權限 chmod 700 /root/svn.sh或chmod ug+x /root/svn.sh 添加到自動運行 vi /etc/rc.local 在最後添加一行內容 /root/svn.sh 而後重啓服務器,使用ps aux|grep svn來查看svn是否啓動.好了,若是還有更好的方法請你們通知我下.