判断apache是否启动的脚本

#!/bin/bash
http=$(netstat -tunpl | awk '{printf $4 " "}' | grep '80$')
if [ -z "$http" ]
then
echo "http doing run"
/etc/init.d/httpd start
else
echo "runing"
fi

原文地址:https://www.cnblogs.com/ahwu/p/3728142.html