#!/bin/bash # check_version.sh - check github project for latest release version from cron & email url="https://github.com/USER/REPO/releases/latest" txt="/tmp/release.txt" prj="$(echo $url | awk -F "/" '{print $4 "/" $5}')" cmd="$(curl -sL -o /dev/null -w "%{url_effective}" ${url} | awk -F "/" '{print $NF}')" if [ ! -f "$txt" ]; then echo -n "Latest release: " echo "$cmd" | tee "$txt" else if ! [[ "$cmd" =~ $(cat $txt) ]]; then # TODO: add send email command echo -n "Different versions send email! Repo $prj new version: " echo "$cmd" | tee "$txt" fi fi #EOF