date.chapril.org-tools/monitoring/check_datechaprilorg_update

34 lines
760 B
Plaintext
Raw Permalink Normal View History

2020-01-31 16:28:51 +01:00
#!/bin/bash
#
# Nagios plugin to check paste version
#
2020-05-29 23:26:24 +02:00
# Author : Didier Clermonté <dclermonte@april.org>
# Author : Christian Momon<cmomon@april.org>
2020-01-31 16:28:51 +01:00
# Date : 7 Dec 2019
#
function usage() {
echo "Usage : $0"
}
#
if [ "$#" -ne 0 ]; then
usage
else
lastVersion=$(curl -s https://framagit.org/api/v4/projects/16/releases | jshon -a -e name|cut -d '"' -f2|grep -v '[\^\(alpha\)]'|sort -rV|head -n 1)
2020-01-31 16:28:51 +01:00
currentVersion=$(cd /var/www/date.chapril.org && git branch | grep '*'|cut -c 11-100 )
#echo $currentVersion
#echo $lastVersion
if [ $currentVersion = $lastVersion ]; then
echo "OK"
result=0
else
echo "WARNING : new version available, current is $currentVersion, last is $lastVersion."
result=1
fi
fi
exit $result