#! /bin/bash if [ netstat -tnlup | grep nginx | wc -l -gt 0 ];then echo "Nginx is running." else echo "Nginx is stopped." /etc/init.d/nginx start fi