Linux under the SVN (Subversion) autostart script

Source: Internet
Author: User
Tags svn syslog

for everyone to share the next three kinds of automatic scripts, from easy to difficult!

I use method Two, other methods do not have experimental script one: The following shell script is started, is based on multi-project use of Svnserve-D--listen-port 3690-r/svnroot/rekfan.com/Svnserve-D--listen-port 3691-r/svnroot/rekfan.cn/The svn default boot port is 3690, there are two SVN libraries, so when this happens, the service script above will only start an SVN library. So you need to use shell scripts to implement two SVN libraries. VI/root/svn.shsvn.sh script content:#!/bin/bashsvnserve-d--listen-port 3690-r/svnroot/rekfan.com/Svnserve-D--listen-port 3691-r/svnroot/rekfan.cn/then add executable permissions chmod700/root/svn.sh or chmod ug+x/root/svn.sh add to Auto Run VI/etc/rc.local Add a line at the end/root/svn.sh then restart the server using PS aux|grep svn to see if SVN starts the script two: The SVN service self-priming script puts the script in/etc/init.d/Lower VI/etc/rc.d/init.d/svnsvn script content:#!/bin/bash#chkconfig:- about#DESCRIPTION:SVN Serversvn_home=/svnroot/rekfan.comif[!-F"/usr/bin/svnserve"]thenecho"svnserver startup:cannot Start"Exitficase" $" inchstart) echo"Starting Svnserve ..."/usr/bin/svnserve-d--listen-port 3690-R $SVN _homeecho"finished!";; Stop) Echo"stoping svnserve ..."Killall Svnserveecho"finished!";; restart) stop$0 start;*) echo"USAGE:SVN {Start | stop | restart}"Exit1ESAC Here Please note that do not delete#Chkconfig:-85 15 and # DESCRIPTION:SVN server, otherwise unable to use Chkconfig join service, will prompt service SVN does not support chkconfig.then execute chmod755/etc/init.d/SVN
Join the system to start automatically:

Create a script file in the INIT.D directory svnd.sh
# CD/ETC/INIT.D
# Vim Svnd.sh
Enter the svnd.sh content as follows (/KAIFA/SVN is the SVN repository directory):

#!/bin/bash
#svnserve Startup
/ETC/INIT.D/SVN restart

Save exit.
Update, Modify permissions:

chmod 755 svnd.sh
UPDATE-RC.D svnd.sh Defaults


You can also use the following method to add the default autostart: Chkconfig--add Svnchkconfig svn on last view next Chkconfig--list|grep SVN Script III:#!/bin/sh-e## BEGIN INIT INFO#Provides:svnserve#Required-start: $local _fs $syslog $remote _fs#required-stop: $local _fs $syslog $remote _fs#Default-start:2 3 4 5#default-stop:0 1 6#short-description:start/stop Svnserve## # END INIT INFOpath=/sbin:/usr/sbin:/bin:/usr/Bindesc="Svnserve"NAME=Svnservepidfile=/var/run/$NAME. Piddaemon=/usr/bin/$NAME#Why add--pid-file parameter here? Svnserve writes correct PID into Pidfile.#Start-stop-daemon writes the PID before the process running. It may cause the PID nubmer dismatch.#rely on the--make-pidfile optiondaemon_args="-d-r/opt/svnproject--pid-file= $PIDFILE"ScriptName=/etc/init.d/$NAME [-X"$DAEMON"] ||Exit 0[-r/etc/default/$NAME] &&. /etc/default/$NAME./lib/lsb/init-Functionsdo_start () {Start-stop-daemon--start--quiet--exec$DAEMON--test >/dev/null/| |return1Start-stop-daemon--start--quiet--background--exec$DAEMON--/$DAEMON _args/||return2}#For those prcesses with Chilren processes. Please stop with--exec, plus command name.#--pid-file can only kill parent process. All the children processes is transferred to 1.Do_stop () {Start-stop-daemon--stop--quiet--RETRY=TERM/30/KILL/5--exec "$DAEMON"RETVAL="$?"[ "$RETVAL"= 2] &&return2Start-stop-daemon--stop--quiet--oknodo--RETRY=0/30/KILL/5--exec "$DAEMON"[ "$?"= 2] &&return2RM-F $PIDFILEreturn "$RETVAL"}case" $" inchstart) log_daemon_msg"starting $DESC" "$NAME"if[-S $PIDFILE] && kill-0 $ (cat $PIDFILE) >/dev/null 2>&1; thenlog_daemon_msg"apparently already running"log_end_msg 0exit 0fido_startcase"$?" inch0|) log_end_msg 0;;2) Log_end_msg 1 ;; ESAC;; Stop) log_daemon_msg"stopping $DESC" "$NAME"Do_stopcase"$?" inch0|) log_end_msg 0;;2) Log_end_msg 1 ;; ESAC;; Restart|force-Reload) log_daemon_msg"restarting $DESC" "$NAME"Do_stopcase"$?" inch0|) Do_startcase"$?" inch0) log_end_msg 0;;1) log_end_msg 1;;#Old process is still running*) log_end_msg 1;;#Failed to startEsac;;*)#Failed to stopLog_end_msg 1;; ESAC;;*) echo"Usage: $SCRIPTNAME {start|stop|restart|force-reload}">&2Exit3;; Esacexit 0

Linux under the SVN (Subversion) autostart script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.