Whether the shell script monitor is executing and automatically starts the process if it is not executed

Source: Internet
Author: User

Code inside the monitoring 1 processes, the code is very simple, I do not explain, there is not understand, you can ask in reply.

I saw it and gave it a lecture.

Of course, the script to execute, you need to turn on the system's timer process Crond, and edit the configuration file.

Executive Crontab-e

Enter */1 * * * */home/automonitor.sh to execute the script once a minute.

[C-sharp]View PlainCopy
  1. #!/bin/sh
  2. Cdnclient_pid= ' ps-aux|grep-v ' grep ' |grep-c '/cdn_client_d '
  3. Ulimit-c Unlimited
  4. #echo "$cdnclient _pid"
  5. If [$cdnclient _pid-eq 0]
  6. Then
  7. cd/home/cdnclient/
  8. ./startup.sh
  9. cd/home/
  10. now= ' Date +%y-%m-%d[%h:%m:%s] '
  11. Echo "at $now start cdnclient-b/n" >> check_cdnclient.log
  12. Fi

http://blog.csdn.net/langeldep/article/details/6166648

The shell script monitor is executing and automatically starts the process if it is not executed

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.