2 Star 1 Fork 1

weiliang1216/f5-ve-alicloud-ha

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
active 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
weiliang1216 提交于 2023-12-06 03:07 . update active.
#!/bin/bash
#
# NOTE:
# This file will be installed in /config/faileover/active and it will
# be called by /usr/lib/failover/f5active
#
# - This file is for customer additions for task
# to be performed when failover goes to active
#
# - It is possible for this script to be called multiple times, so it
# should not persist on the system so it won't fill up the process table
start_time=`date +'%Y-%m-%d %H:%M:%S'`
start_seconds=$(date --date="$start_time" +%s)
echo "Start time: "$start_time > aliyun_fc.log
result=''
while true; do
curl '<内网访问地址>/remove' \
-H 'eni-id: <peer-eni-id>' \
-H 'eni-ip: <peer-eni-ip>'
curl '<内网访问地址>/add' \
-H 'eni-id: <self-eni-id>' \
-H 'eni-ip: <self-eni-ip>' > aliyun_result.log
result=`grep -c "Done" aliyun_result.log`
#echo $result
if [[ $result -eq 1 ]]; then
end_time=`date +'%Y-%m-%d %H:%M:%S'`
echo "End time: "$end_time >> aliyun_fc.log
break
fi
end_seconds=$(date --date="$end_time" +%s)
if [[ $((end_seconds - start_seconds)) -lt 15 ]]; then
echo "Failover Failed!!!!"
break
fi
sleep 1s
done
echo $(date) >> /tmp/on_active.log
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/weiliang1216/f5-ve-alicloud-ha.git
git@gitee.com:weiliang1216/f5-ve-alicloud-ha.git
weiliang1216
f5-ve-alicloud-ha
f5-ve-alicloud-ha
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385