Created
October 29, 2019 10:08
-
-
Save wellavelino/b04b12a1f6eb534a46567a72f03535e9 to your computer and use it in GitHub Desktop.
gnib_check.sh
This file contains 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 characters
#!/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