2019-03-30脚本

#!/bin/bash
email="[email protected]"
if netstat -lntp |grep ':80' |grep 'httpd'
then
   echo "80 port no problem"
   exit
else
   /usr/local/apache2.4/bin/apachectl restart
   python mail.py $email "check_80port" "The 80 port is down."
   n=`ps aux |grep httpd|grep -cv grep`

   if [ $n -eq 0 ]
   then
      /usr/local/apache2/bin/apachectl start 2>/tmp/apache_start.err
   fi

   if [ -s /tmp/apache_start.err ]
     then
      python mail.py  $mail 'apache_start_error' `cat /tmp/apache_start.err`
   fi
fi

你可能感兴趣的:(2019-03-30脚本)