Linux shell Script Daemon monitors SVN services

Source: Internet
Author: User
Tags svn

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

Related Article

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.