-
-
Save retraut/f046c409cfe44b08132a5d4c090c78d5 to your computer and use it in GitHub Desktop.
Hetzner simple Failover Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#------------------------------------------------------------ | |
# title :failover.sh | |
# description :This script will call hetzner failover api | |
# author :Sebastian Reimers <[email protected]> | |
# date :18.02.2016 | |
# version :0.1 | |
#------------------------------------------------------------ | |
# settings | |
hlogin="" | |
hpassword="" | |
hserver="https://robot-ws.your-server.de/failover" | |
failoverip="" | |
#------------------------------------------------------------ | |
lhost=$(cat /tmp/failover_last) | |
chost=$(curl http://10.10.1.1/host.html 2>/dev/null) | |
if [ "$lhost" != "$chost" ]; then | |
echo "$lhost != $chost" | |
curl -u $hlogin:$hpassword $hserver/$failoverip -d active_server_ip=$chost | |
echo $chost > /tmp/failover_last | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment