Skip to content

Commit

Permalink
Update scripts due to added metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
schemen committed Aug 20, 2022
1 parent efa8bb1 commit d9e7604
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rootfs/hetzner-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rootfs/hetzner-notify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d9e7604

Please sign in to comment.