icinga-plugins/checks/check_gitea_update

31 lines
930 B
Plaintext
Raw Normal View History

2018-01-17 08:21:01 +01:00
#!/bin/bash
if [ "$#" = 0 ]
then
app_root="/home/git/gitea/gitea"
else
app_root=$1
fi
if [ -e "$app_root" ]
then
gitea_local_version=$($app_root --version | awk '{print $3}')
else
echo "$app_root does not exist. exit"
exit 1
fi
2018-12-10 08:03:47 +01:00
gitea_remote_version=$(curl --silent https://github.com/go-gitea/gitea/releases | grep "/releases/tag" | grep -v "\-rc" | grep -v "\-dev" | cut -d ">" -f 2 | cut -d "<" -f 1 | head -n 1)
#gitea_remote_version=$(curl --silent https://github.com/go-gitea/gitea/releases | grep "css-truncate-target" | grep -v "\-rc" | cut -d "v" -f 2 | cut -d "<" -f 1 | head -n 1)
2018-01-17 08:21:01 +01:00
if [ "$gitea_local_version" = "$gitea_remote_version" ]
then
echo "gitea ist up-to-date - installed version: $gitea_local_version; newest version: $gitea_remote_version"
exit 0
else
#Warnung wird ausgegeben
echo "different version - installed version: $gitea_local_version; newest version: $gitea_remote_version"
exit 1
fi