代码拉取完成,页面将自动刷新
#!/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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。