snippets/src/check-url-until-200-ok/check-publishing.sh

34 lines
695 B
Bash

#!/bin/bash
source publishing.conf.sh
program=$(basename $(pwd))
read -p "version to check > " version
echo "entered version = $version"
url="$baseurl/${version}/"
echo "checking $url"
check(){
echo $(curl -sL -w "%{http_code}\\n" "$url" -o /dev/null)
}
count=0
until [ $count -gt 1000 ] || [ "$(check)" == "200" ]
do
code=$(check)
echo "try $count - response $code"
ping -c 2 127.0.0.1 > /dev/null
count=$((count+1))
done
code=$(check)
if [ "$code" == "200" ]
then
echo "$code is 200"
notify-send -a MAVEN -t 5000 "$program" "version $version is published"
else
echo "$code is not 200"
notify-send -a MAVEN -u critical "$program" "failed to publish $version version"
fi