[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.
This commit is contained in:
jtcressy
2016-03-15 13:09:28 -06:00
parent b23fb93366
commit a1ead0634e

View File

@@ -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"
;;