Hi, I have written a script that when run, emails the result of the ups.
What I would like to do is make it so that it ONLY emails when the UPS is on battery, and then loops back and continually monitors the UPS until the power is restored, at which time it completes the script and sends the power restored message. Any help would be very much appreciated
Kind Regards Murray
:global datetime ([/system clock get time] . " - " . [:pick[/system clock get date] 4 6] . "-" . [:pick [/system clock get date]0 3] . "-" . [:pick[/system clock get date] 7 11])
/system ups monitor [/system ups find name "ups2"] once do {
:if ($on-battery="yes") do {
/tool e-mail send to="email.address@isp.com.au" subject=("Power Failure At " . $datetime) body=("Power Failure at at " . $datetime)
}
}
/system ups monitor [/system ups find name "ups2"] once do {
:if (!$on-battery="yes") do {
/tool e-mail send to="email.address@isp.com.au" subject=(" Power Restored At " . $datetime) body=("Power Restored at " . $datetime)
}
}