From 97f76bb268df3a00f648e53b7aea5d9f141c8be7 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 --- 5etools-docker/init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/5etools-docker/init.sh b/5etools-docker/init.sh index 7f84d283..f44f3b41 100644 --- a/5etools-docker/init.sh +++ b/5etools-docker/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