Simple nginx,mysql,http Daemon Boot program

Source: Internet
Author: User

#!/bin/bash  #shell自检启动守护程序   #有时候服务进程会挂掉, can run a daemon script, detect running status, start, email checkmysql= ' pgrep mysql '   checknginx= ' Pgrep nginx '  checkhttpd= ' pgrep httpd '   while : do      date=$ (date + "%y-%m-%d %h:%m:%s")           if [ -n  "$checkMysql"  ]; then                  echo  ' Mysql normal '  >/dev/null 2 >&1         else                  /usr/local/mysql/bin/mysqld_safe -- defaults-file=/usr/local/mysql/my.cnf                  echo  ' checked error: mysqld at  '   $date  > > /root/server_error.log                  #send  mail        fi           if [ -n  "$checkNginx"  ]; then                  echo  ' Nginx normal '  >/dev/null  2>&1         else                  /usr/local/nginx/sbin/nginx                  echo  ' checked error: nginx at  '   $date  >> /root/server_error.log                   #send  mail         fi          if [ -n  "$CHECKHTTPD"  ]; then                  echo  ' Httpd normal '  >/dev/null 2>&1          else                  /usr/local/apache/bin/apachectl start                  echo  ' Checked error: httpd at   '   $date  >> /root/server_error.log                   #send  mail         fi           #休眠           sleep&nbsP;5 done 


This article is from the "Chen Nan Run" blog, please be sure to keep this source http://chennanrun.blog.51cto.com/4583928/1622621

Simple nginx,mysql,http Daemon Boot program

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.