Page 1 of 1

Send specific log line over sms

Posted: Thu Nov 19, 2020 1:01 am
by nemke
I am terible in scripting

I need script to send specific log over SMS

Every 15 days, MT check SIM credit bilans over Ussd codes. So now I like to send that reply over SMS to my number.
After MT sheck SIM credit, in Log i see line "USSD: Your credic is 17Eur"
So now I like just to copy this and send over SMS to my number

Help ?

Re: Send specific log line over sms

Posted: Fri Nov 20, 2020 10:13 pm
by nemke
To be exact I need just BOLD part, how to copy specific massage from log, and make $output to use it like message for Pushpver and SMS

#SCRIPT shows USSD SIM balans and send over SMS &/or Pushover
#SIM Balans check
/interface lte at-chat lte1 input="AT+CUSD=1,\"AAD82CA68A8D1A\",15" wait=yes

#Wait 10 sec
:delay 10s

#Define $output. Find Log with word "USSD" Copy all log line message
:global ime;
:set ime "$[/system identity get name]";

:local startBuf [:toarray [ /log find where message ~"USSD"]];
:local output "$[/log get [:pick $currentBuf] message ]";

#Send over Pushover
/tool fetch mode=https url="" http-method=post http-data="token=xxxxxxxxxxxxxxx&user=xxxxxxxxxxxxxxxx&sound=gamelan&priority=0&title=$ime&message=$output" keep-result=no

#Send ove SMS
/tool fetch send sms port=lte1 phone-number=xxxxxxx message=$output

:log info "Report Send"

Re: Send specific log line over sms

Posted: Mon Nov 23, 2020 10:41 pm
by nemke
Anyone have something simular ?