Process check script under Apache environment

Source: Internet
Author: User

In the actual production environment using a more than a multi-web environment is generally Apache, in order to ensure that Apache normal operation, will certainly be the Apache process monitoring, but generally the efficiency is not very good, In order to ensure that the business in the production environment is functioning properly or that a failure can be handled quickly, it is possible to determine whether a httpd TCP connection is available in the check system, and a script to check Apache is written

#!/bin/bash#apache_deamon.shlog=/data/backup/apache_status/logs# event record httpd_num= ' Netstat-ntpa |grep:80 |wc-l ' apache_bin=/usr/local/apache/binif [!-e "$log"];then mkdir-p "$log" fiif [$httpd _num-eq 0];then $apache _bi N/apachectl restart|tee-a $log/' date + '%y%m%d-%h:%m '. Log >/dev/null 2>&1 &fi

And then add the timer to the crontab to check once a minute.

*/1 * * * */usr/local/scripts/apache_deamon.sh

Of course, this script can also be used to check some services that require TCP or UDP connections.

This article from "Technical essay" blog, declined reprint!

Process check script under Apache environment

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.