Skip to content

Instantly share code, notes, and snippets.

@wellavelino
Created October 29, 2019 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wellavelino/b04b12a1f6eb534a46567a72f03535e9 to your computer and use it in GitHub Desktop.
Save wellavelino/b04b12a1f6eb534a46567a72f03535e9 to your computer and use it in GitHub Desktop.
gnib_check.sh
#!/bin/bash
BOT_TOKEN=""
CHAT_ID=""
MESSAGE=""
LAST_MESSAGE=""
COUNT=0
while true; do
slot=$(curl -ks https://burghquayregistrationoffice.inis.gov.ie/Website/AMSREG/AMSRegWeb.nsf/\(getApps4DTAvailability\)\?readform\&\&cat\=Other\&sbcat\=All\&typ\=Renewal)
if [ $slot == '{"empty":"TRUE"}' ]; then
MESSAGE="No slots available, trying again..."
else
MESSAGE="Slot is available..."
fi
COUNT=$[$COUNT+1]
if [ $COUNT -gt 60 ]; then
LAST_MESSAGE=""
COUNT=0
fi
if [ "$MESSAGE" != "$LAST_MESSAGE" ]; then
curl --data chat_id=$CHAT_ID --data-urlencode "text=$MESSAGE" "https://api.telegram.org/bot$BOT_TOKEN/sendMessage" &> /dev/null
LAST_MESSAGE=$MESSAGE
fi
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment