From d9e7604affe2d3a7279a79e40fdd5025e0fd6129 Mon Sep 17 00:00:00 2001 From: Schemen Date: Sat, 20 Aug 2022 16:49:13 +0200 Subject: [PATCH] Update scripts due to added metadata --- rootfs/hetzner-check.sh | 2 +- rootfs/hetzner-notify.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rootfs/hetzner-check.sh b/rootfs/hetzner-check.sh index 2021780..49ad18d 100755 --- a/rootfs/hetzner-check.sh +++ b/rootfs/hetzner-check.sh @@ -5,7 +5,7 @@ echo "Executing $0" >>/tmp/master.log if grep -q MASTER "/tmp/endstate"; then SERVER_ID=$(curl -s -H "Authorization: Bearer $HETZNER_TOKEN" "https://api.hetzner.cloud/v1/servers?name=$(hostname -f)" | grep -C 2 servers | grep id | awk '{ print $2 }' | sed -e s/,//) - FLOATING_IP_ID=$(curl -s -H "Authorization: Bearer $HETZNER_TOKEN" "https://api.hetzner.cloud/v1/floating_ips" | grep "\"ip\": \"${FLOATING_IP}" -B 3 | grep id | awk '{ print $2 }' | sed -e s/,//) + FLOATING_IP_ID=$(curl -s -H "Authorization: Bearer $HETZNER_TOKEN" "https://api.hetzner.cloud/v1/floating_ips" | grep "\"ip\": \"${FLOATING_IP}" -B 10 | grep id | awk '{ print $2 }' | sed -e s/,//) CHECK=$(curl -s -H "Authorization: Bearer $HETZNER_TOKEN" "https://api.hetzner.cloud/v1/floating_ips/$FLOATING_IP_ID" | grep \"server\": | awk '{ print $2 }' | sed -e s/,//) if [ "$CHECK" == "$SERVER_ID" ] ; then diff --git a/rootfs/hetzner-notify.sh b/rootfs/hetzner-notify.sh index 0f17781..4b27bfa 100755 --- a/rootfs/hetzner-notify.sh +++ b/rootfs/hetzner-notify.sh @@ -11,7 +11,7 @@ if [ "$ENDSTATE" == "MASTER" ] ; then echo "Transitioning Floating ip to $(hostname -f)..." >>/tmp/master.log SERVER_ID=$(curl -s -H "Authorization: Bearer $HETZNER_TOKEN" "https://api.hetzner.cloud/v1/servers?name=$(hostname -f)" | grep -C 2 servers | grep id | awk '{ print $2 }' | sed -e s/,//) FLOATING_IP=${FLOATING_IP} - FLOATING_IP_ID=$(curl -s -H "Authorization: Bearer $HETZNER_TOKEN" "https://api.hetzner.cloud/v1/floating_ips" | grep "\"ip\": \"$FLOATING_IP" -B 3 | grep id | awk '{ print $2 }' | sed -e s/,//) + FLOATING_IP_ID=$(curl -s -H "Authorization: Bearer $HETZNER_TOKEN" "https://api.hetzner.cloud/v1/floating_ips" | grep "\"ip\": \"$FLOATING_IP" -B 10 | grep id | awk '{ print $2 }' | sed -e s/,//) while : do