add
This commit is contained in:
32
2-生产环境4.0/负载均衡服务器/update-nginx.sh
Normal file
32
2-生产环境4.0/负载均衡服务器/update-nginx.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
if [[ $( ip addr | grep -c "192.168.148.131") -eq 1 ]]; then
|
||||
echo "当前主机为 主loadbalancer节点! 当前时间为 $(date) "
|
||||
|
||||
chown -R nginx:nginx /etc/nginx/
|
||||
|
||||
|
||||
cd /etc/nginx/ && nginx -t
|
||||
cd /etc/nginx/conf.d/ && nginx -t
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
|
||||
echo "nginx conf is wrong ! please check !"
|
||||
return 23
|
||||
fi
|
||||
|
||||
echo "start to sync nginx conf to another nginx node"
|
||||
rclone sync /etc/nginx/ loadbalancer:/etc/nginx/
|
||||
|
||||
|
||||
echo "start to restart this-self and another nginx conf"
|
||||
systemctl restart nginx
|
||||
ssh loadbalancer "systemctl restart nginx"
|
||||
|
||||
|
||||
else
|
||||
|
||||
echo "can't modify nginx conf in this host !"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user