yum install mailx -y ------安装邮件服务
设置邮箱服务相关配置
vim /etc/mail.rc


vim /etc/crontab

ps=$(ps -ef |grep nginx |grep -v grep|wc -l)
if(($ps>0))then
echo "nginx is alreay running"
else
echo "nginx not start,waiting....."
yum install nginx -y > /dev/null
systemctl start nginx
systemctl start firewalld
firewall-cmd --permanent --zone=public --add-server=http > /dev/null
firewall-cmd --permanent --zone=public --add-port=80/tcp > /dev/null
firewall-cmd --reload >/dev/null
echo "nginx is alread running"
fi
ip=$(ip a|grep ens32|grep inet|tr -s " "|cut -d " " -f3|cut -d "/" -f1)---------获取ip
curl -s $ip >/dev/null ------访问网站得到状态码
if (($?==0))--------0为成功访问
then
echo "web server is running"
else
echo "web not accessible"
exit 12
fi
