The recently built SVN service does not know why the service is always turned off (if you do not know how to build SVN can refer to the SVN version control software under Linux ), so a daemon is implemented with shell scripts. Used to monitor if the SVN service is started, if the service is not present.
Create a monitoring script svnmonit.sh
#!/bin/sh#process name can be modifiedPro_name=Svnserveport=58652Rep_dir=/www/Svndata while true; Do #get the number of $pro_name processes with PSnum= ' ps aux | grep ${pro_name} | Grep-v grep |WC-l '#Echo $NUM #小at 1, restart the process if["${num}"-lt "1"];thenEcho"${pro_name} was killed"${pro_name}-d-r ${rep_dir}--listen-Port ${port}fi DoneExit0
The main use of PS and WC, combined with the SVN command to start the SVN process detection.
2. Add Execute Permissions
chmod +x./svnmonit.sh
3. Set Boot start
Modify/etc/rc.local, add at the end of the file
/root/svnmonit.sh
4. Start the svnmonit.sh without rebooting the system
Nohup./svnmonit. SH &
The Nohup command ensures that SVNMONIT.SH continues to execute after the terminal exits.
Reference: http://www.xker.com/page/e2015/03/172040.html
Linux shell Script Daemon monitors SVN services