检测nginx是否正常,如果不正常则自动重启

#!/bin/bash

nginx=`netstat -tnlp | grep 80 | grep nginx | wc -l`

if [ "$nginx" -gt 0 ];then

echo "Nginx is running..."

else

echo "Nginx is stopped"

/application/nginx/sbin/nginx

fi