预防定时重启apache服务没有起来的脚本

内容如下:

#!/bin/bash

test=$(ps aux | grep httpd | grep -v grep)

if [ -n "$test" ]
then
echo "httpd is ok"
else
echo "httpd is not ok"
systemctl restart httpd
fi

 

仅在centos 7里面测试通过

posted @ 2018-03-29 15:27  菜鸟起飞中  阅读(110)  评论(0编辑  收藏  举报