I've been looking for something like this for a while and didnt find anything i was happy with, so i wrote my own. I hope this might be useful for any other lazy admins out there who want to use a cron job to check for updates.
please note, I have not written the actual update process at the end, you will need to write one for yourself, because I've run out of time today to finish it.
Happy to take any suggestions for improvements, also feel free to post your upgrade scripts if you wish
please note, I have not written the actual update process at the end, you will need to write one for yourself, because I've run out of time today to finish it.
Code:
#!/bin/bash
# spider the server download page and get the latest link for your modpack (in this case Direwolf20)
downlink=$(wget -q http://feed-the-beast.com/server-download -O - |\
tr "\t\r\n'" ' "' | \
grep -i -o '<a[^>]\+href[ ]*=[ \t]*"\(ht\|f\)tps\?:[^"]\+"' | \
sed -e 's/^.*"\([^"]\+\)".*$/\1/g' |\
grep "Direwolf20Server.zip")
#Find the version number in the file name
downver=$(basename "$downlink" | grep -E -o '[0-9]_[0-9]_[0-9]{2,}')
#check if the existing zip file has the same version number
exists=$(ls | grep $downver | wc -l)
if [ $exists -gt 0 ]
then
echo "current version"
else
echo "new version available"
### Put your update script here ###
fi
Happy to take any suggestions for improvements, also feel free to post your upgrade scripts if you wish