Script monitors Web server, does not work properly email reminders

Source: Internet
Author: User

  1. Background introduction
    The company has a number of Web sites, no configuration monitoring services, every day to check whether the server is working properly. Inefficient and time-consuming.
  2. Code Snippets
    #!/bin/bash# Author Jerry.huang (Email:[email protected]) # Check Web Serverif[[-Z ' curl-i-S"http://www.baidu.com"|grep "OK"` ]]; ThenEcho "www.baidu.com Server server is down"| Mail-s"www.baidu.com Server Alert"[Email protected],616043155@qq. com &&Echo "$ (date) www.baidu.com server is down">>/home/CheckServerError.logElseEcho "$ (date) www.baidu.com server is OK">>/home/WebCheckSuccess.logfi

  3. Add a Scheduled task
    Crontab-e
    */10 * * * */usr/local/sbin/checkserverhealth.sh >/dev/null 2>&1

  4. Please refer to my previous article on the email feature:
    Http://www.cnblogs.com/Mrhuangrui/p/4589809.html

Script monitors Web server, does not work properly email reminders

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.