#!/bin/bash
if killall -0 httpd > /dev/null 2>&1;then
echo "httpd is running."
else
echo "`date "+%F %T"` httpd is offline" | mail -s ‘Warnning‘ test90@126.com
fi
当然,上面的这个是最最简陋的,只能判断服务进程是否停止,还不能判断网页访问情况。有待改进,如可以自动重启httpd服务,这里只是抛砖引玉。
原文:http://lee90.blog.51cto.com/10414478/1757417