Skip to content

Instantly share code, notes, and snippets.

@gastaldi
Last active April 9, 2020 02:28
Show Gist options
  • Save gastaldi/41bd76a2b539711a81943e3ff8254b1b to your computer and use it in GitHub Desktop.
Save gastaldi/41bd76a2b539711a81943e3ff8254b1b to your computer and use it in GitHub Desktop.
Monitors a Maven coordinate and displays a notification in the UI when it's available - Tested on Fedora only
#!/bin/bash
: ${1:?"groupId is required"}
: ${2:?"artifactId is required"}
: ${3:?"version is required"}
# eg. ~/monitor.sh org.wildfly.swarm spi 1.0.8.Final
GROUP_ID=${1//.//}
ARTIFACT_ID=$2
VERSION=$3
URL="https://repo1.maven.org/maven2/$GROUP_ID/$ARTIFACT_ID/$VERSION/$ARTIFACT_ID-$VERSION.pom"
echo Monitoring $URL
for (( ; ; )); do
STATUS_CODE="$(curl -I --stderr /dev/null $URL | head -1 | cut -d' ' -f2)"
#echo Status code: $STATUS_CODE
if [ "200" == "$STATUS_CODE" ]; then
notify-send "Artifact ${GROUP_ID////.}:$ARTIFACT_ID:$VERSION is now available!"
exit
fi
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment