Compare commits

...

3 Commits

Author SHA1 Message Date
e6327094ce
work from any dir yaayyy 2022-10-16 16:32:27 +05:00
4f7d18cea5
ignore json files 2022-10-16 16:31:56 +05:00
571439b51c
added json output 2022-10-16 16:31:13 +05:00
2 changed files with 26 additions and 19 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@
.*.kate-swp
.cache/*
.cache
status.json
lastcheck.json

View File

@ -1,4 +1,5 @@
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
COUNT=0
while true;
do
@ -6,9 +7,11 @@ source .env
COUNT=$(echo $[$COUNT+1]); echo Count: $COUNT
HTTPREQUEST=$($CURL -si $BML_URL/login > .cache)
STATUS=$(cat .cache | head -n1 | awk '{print $2}'); echo Status: $STATUS
DATE=$(date +'%d-%m-%y')
TIME=$(date +'%H:%M')
if [ "$STATUS" = "200" ]
then
TEXT="🟢BML Online"
TEXT=" BML Online"
else
TEXT="🔴BML Down"
fi
@ -20,7 +23,9 @@ source .env
TGTEXT=$(echo Status: $TEXT%0ACode: HTTP $STATUS | sed "s/ /%20/g");echo Telegram Text: $TGTEXT
echo ""
curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=${TGTEXT}
echo '{"Service":"Internet Banking", "Status":"'$STATUS'", "Date":"'$DATE'", "Time":"'$TIME'"}' | tee -a status.json
fi
fi
echo '{"Date":"'$DATE'", "Time":"'$TIME'"}' | tee -a lastcheck.json
echo Sleep:$DELAY;sleep $DELAY
done