bml-status-tg-bot/bml-status-tg-bot
Shihaam Abdul Rahman ecc89d952a added run script
2021-11-29 18:40:46 +05:00

27 lines
479 B
Bash

#!/bin/bash
source .env
while true;
do
STATUS=$(curl -s $BML_URL/login | jq .code)
if [ "$STATUS" = "0" ]
then
TGTEXT="BML%20Online"
elif [ "$STATUS" = "37" ]
then
TGTEXT="BML%20Down"
else
TGTEXT="Unknown%20Error"
fi
if [ "$STATUS" != "$STATUS_OLD" ]
then
STATUS_OLD=$STATUS
curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=$TGTEXT
fi
sleep $DELAY
done