pad.chapril.org-tools/monitoring/check_padchaprilorg_update

24 lines
623 B
Plaintext
Raw Normal View History

2020-08-27 15:01:31 +02:00
#!/bin/bash
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
## last release
a=$(get_latest_release "ether/etherpad-lite")
## installed release
b=$(cat /var/www/etherpad-lite/CHANGELOG.md | grep '# 1' | head -n 1 | tr -d '# ' )
2020-08-27 15:01:31 +02:00
if [ $a == $b ]
then
echo "OK"
exit 0
else
echo "WARNING : new version available, installed is $b, last is $a."
exit 1
fi