网站心跳监控

By admin, 27 一月, 2016

最近网站不知道为什么老是罢工。需要重启php-fpm网站才能重新访问。于是写了以下脚本,然后在crontab里每分钟调用一次。需要注意的是,应该在crontab里添加MAILTO="",否则每分钟会有一封邮件发送到服务器的root账号。

#!/bin/bash

wget cto.eguidedog.net -O /tmp/cto_heartbeat

if [ ! -s /tmp/cto_heartbeat ]
then
  echo "cto.eguidedog.net die at $(date). restarted" | mail -s "cto.eguidedog.net die" -r root@cto.eguidedog.net myemail@mail.com
  service php5-fpm restart
fi

评论

Restricted HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img src>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。
验证码
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
请输入"Drupal10"