xiyou 发表于 2018-11-24 07:35:25

Apache.sh监控

  以下shell功能为监控apache是否正常运行,如果不正常运行,就重新启动apache
  apache.sh
  #!/bin/bash
#apache.sh
  nc -w2 localhost 80
  if [$? -ne 0]
then
echo "apache's 80 port is down,please you restart the apache progress!"|mailuser1@g.cn-s "apache is down"
/usr/local/apache2/bin/apachectl start
fi
  




页: [1]
查看完整版本: Apache.sh监控