Page 1 of 1
Need help with my script
Posted: Fri Aug 01, 2014 12:05 pm
by marcos512
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
Re: Need help with my script
Posted: Fri Aug 01, 2014 1:45 pm
by wcsnet
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.
Re: Need help with my script
Posted: Fri Aug 01, 2014 1:48 pm
by wcsnet
Your mail syntax looks wrong
Re: Need help with my script
Posted: Sun Aug 03, 2014 1:02 am
by marcos512
as would be the script? need help for resolve please.
Re: Need help with my script
Posted: Wed Aug 13, 2014 6:49 pm
by kr4k3n
I believe quotes around the email addresses might help.
Re: Need help with my script
Posted: Wed Aug 13, 2014 6:57 pm
by rextended
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";
};
Re: Need help with my script
Posted: Fri Nov 28, 2014 10:42 pm
by marcos512
Thanks Very Much