From 0d3a6aade103c3c9f08dfdbcc7bf7297df11e0ae Mon Sep 17 00:00:00 2001 From: Yorick Downe Date: Fri, 29 Dec 2023 15:16:04 +0000 Subject: [PATCH] Better offline detection --- .eth/ethdo/create-withdrawal-change.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.eth/ethdo/create-withdrawal-change.sh b/.eth/ethdo/create-withdrawal-change.sh index 1369c2ad..6d2c089f 100755 --- a/.eth/ethdo/create-withdrawal-change.sh +++ b/.eth/ethdo/create-withdrawal-change.sh @@ -32,8 +32,13 @@ fi echo "Checking whether machine is online" echo ping -c 4 1.1.1.1 && { echo; echo "Machine is online, please disconnect from Internet"; exit 1; } -ping -c 4 8.8.8.8 && { echo; echo "Machine is online, please disconnect from Internet"; exit 1; } -echo "Safely offline. Running ethdo to prep withdrawal address change." +__code=$? +if [ "$__code" -eq 2 ]; then + echo "Safely offline. Running ethdo to prep withdrawal address change." +else + echo "Ping failed, but with error code $__code - the machine may not be offline. Aborting." + exit 1 +fi echo while true; do read -rp "What is your desired Ethereum withdrawal address in 0x... format? : " __address