| Server IP : 173.236.233.93 / Your IP : 216.73.217.165 Web Server : nginx/1.28.1 System : Linux dp-9c4aecd272 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:53:05 UTC 2026 x86_64 User : wp_7qsbbu ( 25017242) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : / |
Upload File : |
#!/bin/bash
# dib-lint: disable=/bin/bash sete setu setpipefail dibdebugtrace tabindent
if [ -z "$PUBLIC_IP" ]; then
echo "Error: PUBLIC_IP environment variable is not set."
exit 1
fi
if [ -z "$GATEWAY_IP" ]; then
echo "Error: GATEWAY_IP environment variable is not set."
exit 1
fi
if [ "$DH_NET_VERS" == "v2" ]; then
echo "Using v2 network logic."
if [ -z "$PUB_GATEWAY_IP" ]; then
echo "Error: PUB_GATEWAY_IP environment variable is not set."
exit 1
fi
# Source the environment file
if [ ! -f "/var/run/hamanager_data" ]; then
echo "Error: /var/run/hamanager_data file is missing."
exit 1
fi
source /var/run/hamanager_data
if [ "$HA_I_AM_PRIMARY" == "TRUE" ]; then
echo "Setting default route to PUB_GATEWAY_IP as instance primary."
ip route replace default via "$PUB_GATEWAY_IP"
else
echo "Removing PUBLIC_IP from eth1 and setting default route to private gateway as standby instance."
ip addr del "$PUBLIC_IP/$PUBLIC_IP_MASK" dev eth1
ip route replace default via "$GATEWAY_IP"
fi
else
echo "Using legacy network logic."
if ! ip addr show lo | grep -q "$PUBLIC_IP/32"; then
ip addr add "$PUBLIC_IP/32" dev lo
fi
if ! ip route | grep -q "default"; then
ip route replace default via "$GATEWAY_IP" src "$PUBLIC_IP"
fi
fi
exec "$@"