icinga-plugins/checks/check_gitea_update
2018-01-17 08:21:01 +01:00

37 lines
826 B
Bash
Executable File

#!/bin/bash
if [ "$#" = 0 ]
then
app_root="/home/git/gitea/gitea"
else
app_root=$1
fi
/usr/bin/which lynx > /dev/null 2>&1
if [ ! $? = 0 ]
then
echo "lynx ist nicht installiert"
exit 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
gitea_remote_version=$(lynx -dump https://github.com/go-gitea/gitea/releases | grep -B 2 GiteaBot | grep "]v" | grep -v rc | cut -d "v" -f 2 | head -n 1)
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