From a540df01ef86824bf585a6d6d4a4198a46b8a521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Didier=20Clermont=C3=A9?= Date: Sat, 7 Dec 2019 16:30:56 +0100 Subject: [PATCH] Added check_datechaprilorg_update (#3591) --- tools/check_datechaprilorg_update | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 tools/check_datechaprilorg_update diff --git a/tools/check_datechaprilorg_update b/tools/check_datechaprilorg_update new file mode 100755 index 0000000..9bc0131 --- /dev/null +++ b/tools/check_datechaprilorg_update @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Nagios plugin to check paste version +# +# Author : Didier Clermonté +# Author : Christian Momon +# 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\)]'|head -n 1) + 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