Last active
April 19, 2021 10:18
-
-
Save trygvea/43bcfe93f8bdbd48bb922550b4e38f8e to your computer and use it in GitHub Desktop.
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 | |
# Smcn | |
# ============= | |
if [ $# -eq 0 ]; then | |
echo "Enter date and module, ex 20-05-2021-modul-6" | |
exit | |
fi | |
# Dates | |
#nextDate="06-05-2021-modul-6" | |
nextDate="$1" | |
url1="https://smcn.no/produkt/rudskogen-${nextDate}/" | |
interval1=30 | |
echo "Checking if Rudskogen has openend ordering for ${nextDate}" | |
while : | |
do | |
http_status=`curl -sL -w "%{http_code}" -I ${url1} -o /dev/null` | |
if [ "$http_status" == "200" ] | |
then | |
echo "" | |
echo "Booking on ${nextDate} opened at $(date)" | |
break | |
fi | |
echo -n "." | |
sleep $interval1 | |
done | |
echo "Sending Codebreaker event!" | |
SLACK_CURL="curl -X POST -H 'Content-type: application/json' --data" | |
WEBHOOK_URL="https://hooks.slack.com/services/<pluss mye mer som du finner et annet sted>" | |
$SLACK_CURL '{"text": "Attention <!channel>"}' $WEBHOOK_URL | |
sleep 0.1 | |
$SLACK_CURL '{"text": "Attention <!channel>"}' $WEBHOOK_URL | |
sleep 0.2 | |
$SLACK_CURL '{"text": "<!channel> Påmelding til rudskogen har åpnet!!! \nGå til <https://smcn.no/arrangementer/rudskogen/>"}' $WEBHOOK_URL | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment