[root@server ~]
afs boot etc lib lost+found mnt proc run srv test usr
bin dev home lib64 media opt root sbin sys tmp var[root@server ~]
num=$(ps -ef | grep nginx | grep -v grep | wc -l) if ((num==0))
thenecho "nginx正在安装,请等待......"yum install nginx -y &> /dev/nullecho "正在部署网站,请等待......"sed -i '42s/\/usr\/share\/nginx\/html/\/test/g' /etc/nginx/nginx.confsystemctl start nginxcurl 192.168.160.137 &> /dev/nullecho "网站搭建成功,请在Windows的浏览器输入IP地址进行查看,脚本执行结束。"
elsesed -i '42s/\/usr\/share\/nginx\/html/\/test/g' /etc/nginx/nginx.confsystemctl restart nginxcurl 192.168.160.137 &> /dev/nullecho "网站搭建成功,请在Windows的浏览器输入IP地址进行查看,脚本执行结束。"
fi