nginx 无感发布
2023-04-13 本文已影响0人
乘以零
#!/bin/bash
IpPort=$1
ConfFile=$2
echo "$IpPort $ConfFile then sed"
sed -i s/#server\ "$IpPort"/server\ $IpPort/g "/usr/local/openresty/nginx/conf/conf.d/$ConfFile"
echo "sed success then reload nginx"
/usr/local/openresty/nginx/sbin/nginx -t
if [ $? != 0 ]; then
echo "[start] Error, Nginx conf file test error!!!!!!"
exit 1
fi
/usr/local/openresty/nginx/sbin/nginx -s reload
echo "reload nginx success"
sh /home/yiwu/autodeploy/replace_ngx_us.sh 172.16.126.156:8080 app.conf
sshpass -p 'yourpassword' ssh root@10.6.30.138 sh /home/yiwu/autodeploy/recove_ngx_us.sh 172.16.126.156:8080 app.conf