|
@@ -1,7 +1,9 @@
|
|
|
#!/bin/bash
|
|
|
|
|
|
-# Version 1.3
|
|
|
+# Version 1.4
|
|
|
#
|
|
|
+# v1.4 CHANGES:
|
|
|
+# - added extra logic to deal with unresponsive or empty response from release-url
|
|
|
# v1.3 CHANGES:
|
|
|
# - Added check for configured apache-user and basepath exist.
|
|
|
# v1.2 CHANGES:
|
|
@@ -65,10 +67,13 @@ NCINSTALLED=$(sudo -u $APACHEUSER php $BASEPATH/occ status --output=json | jq -r
|
|
|
# Get latest avaiable version information
|
|
|
# In v29.x.x this has changed outputs <name-of-instance> <version>,
|
|
|
|
|
|
-NCAVAILABLE=$(curl -s $RELEASEURL | sed -e 's/<[^>]*>//g' | grep -o "^nextcloud.*.zip" | tail -n1 | cut -d'-' -f 2 | sed 's/.\{4\}$//')
|
|
|
+NCAVAILABLE=$(curl -s --connect-timeout 5 --fail-with-body $RELEASEURL | sed -e 's/<[^>]*>//g' | grep -o "^nextcloud.*.zip" | tail -n1 | cut -d'-' -f 2 | sed 's/.\{4\}$//')
|
|
|
|
|
|
+# if the check on the release-url is not returning a version - report status
|
|
|
+if [ -z $NCAVAILABLE ]; then
|
|
|
+ echo "1 \"NextCloud\" - No data received from release-URL, can not determine latest release-version"
|
|
|
# compare resuts of installed and available version and report update available if they differ
|
|
|
-if [ $NCINSTALLED != $NCAVAILABLE ]; then
|
|
|
+elif [ $NCINSTALLED != $NCAVAILABLE ]; then
|
|
|
echo "1 \"NextCloud\" - A new NextCloud version ($NCAVAILABLE)is available, running version $NCINSTALLED please upgrade"
|
|
|
else
|
|
|
sudo -u $APACHEUSER php $BASEPATH/occ status -e
|