Files
zeaslity 437acbeb63 add
2024-10-30 16:30:51 +08:00

21 lines
563 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
export log_file=/etc/keepalived/report.log
if [[ $( ip addr | grep -c "192.168.148.131") -eq 1 ]]; then
echo "当前主机为 主loadbalancer节点 当前时间为 $(date) " >> ${log_file}
echo "start to sync nginx conf to another loadbalancer" >> ${log_file}
rclone sync /etc/nginx/ loadbalancer:/etc/nginx/ >> ${log_file}
echo "start to reload the other loadbalancer nginx" >> ${log_file}
ssh loadbalancer "systemctl restart nginx"
echo "" >> ${log_file}
echo "----------------------------" >> ${log_file}
fi