代码如下:
新建 run.sh 写入保存
s= ps -fe |grep "/usr/sbin/httpd"
ls_date=`date +%Y-%m-%d%H:%M:%S`
if [ -n $s ]; then
#service httpd start echo ${ls_date} 'httpd is ok ' >> run.log
else service httpd start echo ${ls_date} 'httpd is error restart ' >> run.log
fi
使用crontab定时执行