Created
June 2, 2019 21:19
-
-
Save chadmayfield/a9dd44781eba1c0d89dcdfa1ac4f52a3 to your computer and use it in GitHub Desktop.
Revisions
-
chadmayfield revised this gist
Jun 2, 2019 . No changes.There are no files selected for viewing
-
chadmayfield created this gist
Jun 2, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ #!/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