Posted By

fhumayun on 06/08/12


Tagged

bashmonit php5-fpmfpmnginx


Versions (?)

php5-fpm monit


 / Published in: Perl
 

  1. #!/bin/sh
  2. HTTP_STATUS=`lynx -head -source http://www.seekeraftertruth.com/ | head --lines=1 | awk '{print $2}'`
  3.  
  4. SUBJECT="[Alert] Php5-fpm Error code: $HTTP_STATUS restarted"
  5. # Email from
  6. EMAIL_FROM="[email protected]"
  7. # Email to
  8. EMAIL_TO="satfeed@liHumayun
  9. # Email text/message
  10. EMAILMESSAGE="Error Status $HTTP_STATUS detected. Restart performed at `date` "
  11.  
  12.  
  13. if [ "$HTTP_STATUS" != "200" ]
  14. then
  15. service php5-fpm restart
  16. echo $EMAILMESSAGE | mail -s "$SUBJECT" "$EMAIL_TO" -a "Reply-To: $EMAIL_FROM"
  17. fi

Report this snippet  

You need to login to post a comment.