From 087a000c9174352447c12a90240d369c14c2bfab Mon Sep 17 00:00:00 2001 From: Jafner <40403594+Jafner@users.noreply.github.com> Date: Thu, 9 Sep 2021 14:07:19 -0700 Subject: [PATCH] Significantly improved handling of failed connection to server --- init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.sh b/init.sh index 7f84d28..f44f3b4 100644 --- a/init.sh +++ b/init.sh @@ -3,9 +3,9 @@ echo "STARTING" > /status echo " === Checking internet connectivity..." -curl -s get.5e.tools > /dev/null +SITE_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://get.5e.tools) -if [ $? = 0 ] # if the get.5e.tools site is accessible +if [ $SITE_STATUS = 200 ] # if the get.5e.tools site is accessible then echo "CHECKING FOR UPDATE" > /status FN=`curl -s -k -I https://get.5e.tools/src/|grep filename|cut -d"=" -f2 | awk '{print $1}'` # get filename of most recent version