taky me to nejede, vypis z terminalu
[admin@MikroTik] > :local mailserver [:resolve mailserver];
failure
[admin@MikroTik] > :local mailfrom "from@domain.xy";
[admin@MikroTik] > :local mailto "to@domain.xy";
[admin@MikroTik] > :local upsName "ups1";
[admin@MikroTik] >
[admin@MikroTik] > #
[admin@MikroTik] > # do NOT make changes below!
[admin@MikroTik] > #
[admin@MikroTik] >
[admin@MikroTik] > :global flagonbatt;
[admin@MikroTik] > :global flagbattlow;
[admin@MikroTik] >
[admin@MikroTik] > :local battalarm 15;
[admin@MikroTik] > :local battok 40;
[admin@MikroTik] >
[admin@MikroTik] > :local curonbatt;
[admin@MikroTik] > :local curcharge;
[admin@MikroTik] >
[admin@MikroTik] > :local sysname [/system identity get name];
[admin@MikroTik] > :local datetime "$[/system clock get date] $[/system clock ge
t time]";
[admin@MikroTik] >
[admin@MikroTik] > # First run
blink --
certificate -- Certificate management
driver -- Driver management
file -- Local router file storage.
import --
interface --
ip --
log -- System logs
metarouter --
password -- Change password
ping -- Send ICMP Echo packets
port -- Serial ports
ppp -- Point to Point Protocol
queue -- Bandwidth management
quit -- Quit console
radius -- Radius client settings
redo -- Redo previosly undone action
routing --
setup -- Do basic setup of system
snmp -- SNMP settings
special-login -- Special login users
store --
system --
tool -- Diagnostics tools
undo -- Undo previous action
user --
export -- Print or save an export script that can be used to restore configurati
on
[admin@MikroTik] > # First run If so, we need to initialize the global flags
[admin@MikroTik] > :if ([:typeof $flagonbatt]="nothing") do={:set flagonbatt 0}
[admin@MikroTik] > :if ([:typeof $flagbattlow]="nothing") do={:set flagbattlow 0
}
[admin@MikroTik] >
[admin@MikroTik] > :set curonbatt false;
expected variable name (line 1 column 6)
[admin@MikroTik] > :set curcharge 100;
expected variable name (line 1 column 6)
[admin@MikroTik] > /system ups monitor [/system ups find name=$upsName] once do=
{
syntax error (line 1 column 45)
[admin@MikroTik] > :set curonbatt $"on-battery"; :set curcharge $"battery-char
ge";
expected variable name (line 1 column 8)
[admin@MikroTik] > }
[admin@MikroTik] >
[admin@MikroTik] > :if (($curonbatt) && ($flagonbatt=0)) do={
syntax error (line 1 column 8)
[admin@MikroTik] > :set flagonbatt 1;
[admin@MikroTik] > /tool e-mail send from=$mailfrom to=$mailto server=$mailserv
er subject="$sysname: Power failure!" \
syntax error (line 1 column 25)
[admin@MikroTik] > body="$sysname is on battery since $datetime";
syntax error (line 1 column 9)
[admin@MikroTik] > :log info "Power-Fail: EMail sent to $mailto";
expected end of command (line 1 column 40)
[admin@MikroTik] > }
[admin@MikroTik] >
[admin@MikroTik] > :if ((!$curonbatt) && ($flagonbatt=1)) do={
syntax error (line 1 column 9)
[admin@MikroTik] > :set flagonbatt 0;
[admin@MikroTik] > /tool e-mail send from=$mailfrom to=$mailto server=$mailserv
er subject="$sysname: Power is back" \
syntax error (line 1 column 25)
[admin@MikroTik] > body="$sysname is back on power since $datetime";
syntax error (line 1 column 9)
[admin@MikroTik] > :log info "Power-Restore: Email sent to $mailto";
expected end of command (line 1 column 43)
[admin@MikroTik] > }
[admin@MikroTik] >
[admin@MikroTik] > :if (($curcharge <= $battalarm) && ($flagbattlow=0)) do={
syntax error (line 1 column 8)
[admin@MikroTik] > :set flagbattlow 1;
[admin@MikroTik] > /tool e-mail send from=$mailfrom to=$mailto server=$mailse
rver subject="$sysname: Low battery!" \
syntax error (line 1 column 27)
[admin@MikroTik] > body="$sysname battery is at $curcharge %! $datetime";
syntax error (line 1 column 9)
[admin@MikroTik] > :log info "Batt-Low: Email sent to $mailto";
expected end of command (line 1 column 38)
[admin@MikroTik] > }
[admin@MikroTik] >
[admin@MikroTik] > :if (($curcharge >= $battok) && ($flagbattlow=1)) do={
syntax error (line 1 column 8)
[admin@MikroTik] > :set flagbattlow 0;
[admin@MikroTik] > /tool e-mail send from=$mailfrom to=$mailto server=$mailse
rver subject="$sysname: Battery recharged" \
syntax error (line 1 column 27)
[admin@MikroTik] > body="$sysname Battery recharged to $curcharge% $datetime
";
syntax error (line 1 column 9)
[admin@MikroTik] > :log info "Batt-Recharged: Email sent to $mailto";
expected end of command (line 1 column 44)
[admin@MikroTik] > }