icinga-plugins/checks/check_owncloud_update
2018-01-17 08:21:01 +01:00

40 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
owncloud_root="/var/www/owncloud/"
if [ -e $owncloud_root/version.php ]
then
# echo "owncloud Version 6 oder hoeher erkannt"
version_full=$(grep OC_VersionString $owncloud_root/version.php | cut -d"'" -f2)
fi
#Versionspruefung
#echo version_full: $version_full
if [ "$version_full" = "8.0" ]
then
version_full="8.0.0"
fi
#echo nachbearbeitet version_full: $version_full
version_short=$(echo $version_full | cut -d "." -f1-2)
#echo version_short: $version_short
version_website=$(w3m -dump http://owncloud.org/changelog/ | egrep "(Version|Release) $version_short" | head -n 1 | cut -d " " -f 2)
#echo version_website: $version_website
if [ "$version_full" = "$version_website" ]
then
echo "owncloud ist up-to-date - installed version: $version_full; newest version: $version_website"
exit 0
#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