attempt fix empty notification on new day
This commit is contained in:
parent
c0b2465e3d
commit
f2483ae4b7
@ -14,6 +14,12 @@ CHECKDIFF2=$(echo $HISTORY | wc -c) ; echo $CHECKDIFF2 # check new history
|
|||||||
DELAY=$(cat delay) ; echo $DELAY # read delay file and get value
|
DELAY=$(cat delay) ; echo $DELAY # read delay file and get value
|
||||||
if [ "$CHECKDIFF1" != "$CHECKDIFF2" ] # if previous history do not match with new history
|
if [ "$CHECKDIFF1" != "$CHECKDIFF2" ] # if previous history do not match with new history
|
||||||
then
|
then
|
||||||
|
if [ "$CHECKDIFF2" = "1" ]
|
||||||
|
then
|
||||||
|
echo "=============" ; echo NEW DAY ; echo "============="
|
||||||
|
curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=GO%20TO%20SLEEP,%20ITS%0000
|
||||||
|
else
|
||||||
|
echo $HISTORY | jq
|
||||||
DESCRIPTION=$(echo $HISTORY | jq -r .description | head -n1) ; echo $DESCRIPTION # get last trascation description
|
DESCRIPTION=$(echo $HISTORY | jq -r .description | head -n1) ; echo $DESCRIPTION # get last trascation description
|
||||||
AMOUNT=$(echo $HISTORY | jq -r .amount | head -n1) ; echo $AMOUNT # get last trascation amount
|
AMOUNT=$(echo $HISTORY | jq -r .amount | head -n1) ; echo $AMOUNT # get last trascation amount
|
||||||
if [ "$DESCRIPTION" = "Transfer Credit" ] # if last trascation is description is Transfer Credit
|
if [ "$DESCRIPTION" = "Transfer Credit" ] # if last trascation is description is Transfer Credit
|
||||||
@ -37,6 +43,7 @@ then
|
|||||||
curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=$TGTEXT #send to telegram
|
curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=$TGTEXT #send to telegram
|
||||||
echo "Next check in $DELAY seconds"
|
echo "Next check in $DELAY seconds"
|
||||||
unset DESCRIPTION ; unset AMOUNT ; unset FROMTOAT ; unset ENTITY ; unset TGTEXT
|
unset DESCRIPTION ; unset AMOUNT ; unset FROMTOAT ; unset ENTITY ; unset TGTEXT
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "nothing new..checking again in $DELAY seconds"
|
echo "nothing new..checking again in $DELAY seconds"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user