change delay without restarting script
This commit is contained in:
parent
b7f44ad401
commit
636512cbfc
@ -4,7 +4,7 @@ mkdir -p ~/.cache/bml-cli/
|
|||||||
TG_BOTAPI='https://api.telegram.org/bot'
|
TG_BOTAPI='https://api.telegram.org/bot'
|
||||||
BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api'
|
BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api'
|
||||||
COOKIE=~/.cache/bml-cli/cookie
|
COOKIE=~/.cache/bml-cli/cookie
|
||||||
|
SLEEP=120
|
||||||
while true; do
|
while true; do
|
||||||
LOGIN=$(curl -s -c $COOKIE $BML_URL/login --data-raw username=$BML_USERNAME --data-raw password=${BML_PASSWORD} | jq -r .code)
|
LOGIN=$(curl -s -c $COOKIE $BML_URL/login --data-raw username=$BML_USERNAME --data-raw password=${BML_PASSWORD} | jq -r .code)
|
||||||
if [ "$LOGIN" = "0" ]
|
if [ "$LOGIN" = "0" ]
|
||||||
@ -22,7 +22,7 @@ CHECKDIFF2=$(echo $HISTORY | wc -c)
|
|||||||
|
|
||||||
if [ "$CHECKDIFF1" = "$CHECKDIFF2" ]
|
if [ "$CHECKDIFF1" = "$CHECKDIFF2" ]
|
||||||
then
|
then
|
||||||
echo nothing new..checking again
|
echo "nothing new..checking again in $SLEEP seconds"
|
||||||
else
|
else
|
||||||
TRANSFERAMOUNT=$(echo $HISTORY | jq -r .amount | head -n1)
|
TRANSFERAMOUNT=$(echo $HISTORY | jq -r .amount | head -n1)
|
||||||
TRANFERFROM=$(echo $HISTORY | jq -r .narrative3 | head -n1)
|
TRANFERFROM=$(echo $HISTORY | jq -r .narrative3 | head -n1)
|
||||||
@ -31,5 +31,6 @@ else
|
|||||||
TRANFERFROM=`echo "$TRANFERFROM" | sed "s/ /%20/g"`
|
TRANFERFROM=`echo "$TRANFERFROM" | sed "s/ /%20/g"`
|
||||||
curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=From:%20$TRANFERFROM%0AMVR:%20$TRANSFERAMOUNT > /dev/null
|
curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=From:%20$TRANFERFROM%0AMVR:%20$TRANSFERAMOUNT > /dev/null
|
||||||
fi
|
fi
|
||||||
|
SLEEP=$(cat delay)
|
||||||
sleep $SLEEP
|
sleep $SLEEP
|
||||||
done
|
done
|
||||||
|
1
bml-tg-notify/delay
Normal file
1
bml-tg-notify/delay
Normal file
@ -0,0 +1 @@
|
|||||||
|
120
|
@ -3,4 +3,3 @@ BML_PASSWORD=''
|
|||||||
BML_ACCOUNTID=''
|
BML_ACCOUNTID=''
|
||||||
TG_BOT_TOKEN=''
|
TG_BOT_TOKEN=''
|
||||||
TG_CHATID=''
|
TG_CHATID=''
|
||||||
SLEEP=30
|
|
||||||
|
Before Width: | Height: | Size: 87 B After Width: | Height: | Size: 78 B |
Loading…
x
Reference in New Issue
Block a user