From a1ead0634efec239f5d56f706c9a6bb4252f21d0 Mon Sep 17 00:00:00 2001 From: jtcressy Date: Tue, 15 Mar 2016 13:09:28 -0600 Subject: [PATCH] [mc] New method of downloading newer spigot server executable. using double pipe "||", bash will continue to the next statement if the first statement returns false or has an error. Using the -N option, wget will overwrite the file if it is newer. So, if the -O option was used, and both wget commands failed (both http and https were down) then wget would overwrite the file with a 0 byte copy and effectively delete it. -N works better in this case, since wget will not overwrite it with an empty file if it can't download it. --- minecraft-server/start-minecraft.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index 0c564edd..2848139f 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -62,9 +62,8 @@ case "$TYPE" in ;; esac - #BAD Idea - #rm -f $SERVER - wget -q https://getspigot.org$URL + #attempt https, and if it fails, fallback to http and download that way. Display error if neither works. + wget -q -N spigot_server.jar https://getspigot.org$URL || (echo "Falling back to http, unable to contact server using https..." && wget -q -N spigot_server.jar http://getspigot.org$URL) || echo "Unable to download new copy of spigot server" ;;