Community discussions

MikroTik App
 
marcos512
just joined
Topic Author
Posts: 5
Joined: Thu Feb 10, 2011 11:00 pm

Need help with my script

Fri Aug 01, 2014 12:05 pm

hello anyone can tell me or help what is wrong I will not my script.

Use Scrip Mikrotik V6.17

My Scrip

/system scheduler

:if ([/ping 192.168.20.28 count=4]=0) do={
:log info \ "Ping down"
:global ip [:resolve "smtp.gmail.com"];
/tool e-mail send to=myemail@gmail.com subject= "Not Working IP" from=myemail@gmail.com start-tls=yes server="$ip" body="Not working check IP http://192.168.20.28/"
:log info "send Email Finish"
}

Thanks very Much
 
wcsnet
Frequent Visitor
Frequent Visitor
Posts: 65
Joined: Mon Apr 29, 2013 12:43 pm
Location: South Africa

Re: Need help with my script

Fri Aug 01, 2014 1:45 pm

The best way to debug script is line by line.
If there is one line that is wrong the entire script wont work at all.
Try to break you script down into simple sections like in your example have the ping result written to a var and then use the var in your if.
Small things like that make these scripts much easier to read and debug.
 
wcsnet
Frequent Visitor
Frequent Visitor
Posts: 65
Joined: Mon Apr 29, 2013 12:43 pm
Location: South Africa

Re: Need help with my script

Fri Aug 01, 2014 1:48 pm

Your mail syntax looks wrong
 
marcos512
just joined
Topic Author
Posts: 5
Joined: Thu Feb 10, 2011 11:00 pm

Re: Need help with my script

Sun Aug 03, 2014 1:02 am

as would be the script? need help for resolve please.
 
kr4k3n
just joined
Posts: 14
Joined: Fri Jan 08, 2010 8:01 pm

Re: Need help with my script

Wed Aug 13, 2014 6:49 pm

I believe quotes around the email addresses might help.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12438
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Need help with my script

Wed Aug 13, 2014 6:57 pm

First of all, write the right syntax, then write FULL syntax with all missing parameters, like username and password for mail...:
:if ([/ping 192.168.20.28 count=4] < 1) do={
 :log info message="Ping down";
 /tool e-mail send start-tls=yes server=[:resolve "smtp.gmail.com"] port=587 user="mygmailid" password="mygmailpassword" from="myemail@gmail.com" to="myemail@gmail.com" subject="Not Working IP" body="Not working check IP http://192.168.20.28/";
 :log info message="send Email Finish";
};
 
marcos512
just joined
Topic Author
Posts: 5
Joined: Thu Feb 10, 2011 11:00 pm

Re: Need help with my script

Fri Nov 28, 2014 10:42 pm

Thanks Very Much

Who is online

Users browsing this forum: No registered users and 17 guests