This commit is contained in:
zeaslity
2024-10-30 16:30:51 +08:00
commit 437acbeb63
3363 changed files with 653948 additions and 0 deletions

View 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