icinga-plugins/checks/check_nextcloud_update

63 lines
1.4 KiB
Plaintext
Raw Normal View History

2018-01-17 08:21:01 +01:00
#!/bin/bash
if [ "$#" = 0 ]
then
app_root="/var/www/"
else
app_root=$1
fi
/usr/bin/which lynx > /dev/null 2>&1
if [ ! $? = 0 ]
then
echo "lynx ist nicht installiert"
exit 1
fi
if [ -e "$app_root"/version.php ]
then
2019-03-23 21:58:53 +01:00
# echo "nextcloud Version 6 oder hoeher erkannt"
2018-01-17 08:21:01 +01:00
version_full=$(grep OC_VersionString "$app_root"/version.php | cut -d "'" -f2)
else
echo "$app_root/version.php does not exist. exit"
exit 1
fi
2019-09-28 20:28:12 +02:00
#Debugging-Schalter
2018-01-17 08:21:01 +01:00
#Versionspruefung
#echo version_full: $version_full
if [ "$version_full" = "8.0" ]
then
version_full="8.0.0"
fi
if [ "$version_full" = "10.0" ]
then
version_full="10.0.0"
fi
#echo nachbearbeitet version_full: $version_full
2019-09-28 20:28:12 +02:00
version_short=$(echo $version_full | cut -d "." -f1-2)
2018-01-17 08:21:01 +01:00
#Debugging-Schalter
#echo version_short: $version_short
2019-09-28 20:28:12 +02:00
version_website=$(lynx -dump https://download.nextcloud.com/server/releases/ | grep "tar.bz2.sha512" | grep "]" | grep -- "-$version_short" | tail -n 1 | cut -d "]" -f 3 |awk '{print $1}' | cut -d "-" -f 2 | cut -d "." -f 1-3)
#Debugging-Schalter
2018-01-17 08:21:01 +01:00
#echo version_website: $version_website
if [ "$version_full" = "$version_website" ]
then
2019-03-23 21:58:53 +01:00
echo "nextcloud ist up-to-date - installed version: $version_full; newest version: $version_website"
2018-01-17 08:21:01 +01:00
exit 0
2019-09-28 20:28:12 +02:00
#Debugging-Schalter
2018-01-17 08:21:01 +01:00
#elif [ $version_full -lt $version_website ]
# echo Version ist kleiner
else
#Warnung wird ausgegeben
echo "different version - installed version: $version_full; newest version: $version_website"
exit 1
fi