diff --git a/README.md b/README.md index 6475d6a..22aace6 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,5 @@ ### Kaiten -1. [Hotkey to add link (to JIRA, e.g.)](src/user-script/kaiten-insert-jira-link.tempermonkey.js) \ No newline at end of file +1. [Hotkey to add link (to JIRA, e.g.)](src/user-script/kaiten-insert-jira-link.tempermonkey.js) +2. [Script for checking url availability until it done](src/check-url-until-200-ok/README.md) diff --git a/src/check-url-until-200-ok/README.md b/src/check-url-until-200-ok/README.md new file mode 100644 index 0000000..a3f4e79 --- /dev/null +++ b/src/check-url-until-200-ok/README.md @@ -0,0 +1,11 @@ +# URL checker + +## About + +This script was inspired by the neccesity of checking whether my new Maven artifact is published or not. + +So, the intention is to check the Maven Central URL on its existence. + +## Settings + +Don't forget to set up it properly. It needs a `baseurl` variable to be set into `publishing.conf.sh`. diff --git a/src/check-url-until-200-ok/check-publishing.sh b/src/check-url-until-200-ok/check-publishing.sh new file mode 100644 index 0000000..1fbd0b3 --- /dev/null +++ b/src/check-url-until-200-ok/check-publishing.sh @@ -0,0 +1,33 @@ +#!/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 diff --git a/src/check-url-until-200-ok/publishing.conf.sh b/src/check-url-until-200-ok/publishing.conf.sh new file mode 100644 index 0000000..bf00468 --- /dev/null +++ b/src/check-url-until-200-ok/publishing.conf.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +export baseurl="https://repo1.maven.org/maven2/me/bvn13/sdk/android/gpx/GpxAndroidSdk"