内容如下:
#!/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里面测试通过
内容如下:
#!/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里面测试通过
转载于:https://www.cnblogs.com/cnqfz/p/8670065.html