2019-12-07 16:33:01 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Nagios plugin to check paste version
|
|
|
|
#
|
2020-05-29 23:27:15 +02:00
|
|
|
# Author : Didier Clermonté <dclermonte@april.org>
|
|
|
|
# Author : Christian Momon<cmomon@april.org>
|
2019-12-07 16:33:01 +01:00
|
|
|
# Date : 7 Dec 2019
|
|
|
|
#
|
|
|
|
|
|
|
|
function usage() {
|
|
|
|
echo "Usage : $0"
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
if [ "$#" -ne 0 ]; then
|
|
|
|
usage
|
|
|
|
else
|
|
|
|
lastVersion=$(curl -s https://privatebin.info/|grep Current|cut -d' ' -f3|cut -d'<' -f1)
|
|
|
|
currentVersion=$(cd /var/www/paste.chapril.org && git branch | grep '*'|cut -c 11-100 )
|
|
|
|
#echo $lastVersion
|
|
|
|
#echo $currentVersion
|
|
|
|
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
|