mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-16 21:14:29 +02:00
global-functions: introduce $MailServerIsUp
This commit is contained in:
parent
23fe30c4e1
commit
7d2239f24e
1 changed files with 22 additions and 0 deletions
|
@ -34,6 +34,7 @@
|
||||||
:global RandomDelay;
|
:global RandomDelay;
|
||||||
:global DeviceInfo;
|
:global DeviceInfo;
|
||||||
:global ScriptInstallUpdate;
|
:global ScriptInstallUpdate;
|
||||||
|
:global MailServerIsUp;
|
||||||
|
|
||||||
# url encoding
|
# url encoding
|
||||||
:set UrlEncode do={
|
:set UrlEncode do={
|
||||||
|
@ -436,3 +437,24 @@
|
||||||
}
|
}
|
||||||
/ system script run script-updates;
|
/ system script run script-updates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check if mail server is up
|
||||||
|
:set MailServerIsUp do={
|
||||||
|
:local MailServer [ / tool e-mail get address ];
|
||||||
|
:local MailHost $MailServer;
|
||||||
|
|
||||||
|
:if ([ / tool netwatch print count-only where comment=$MailServer ] = 0) do={
|
||||||
|
:log warn ("Adding netwatch entry for mail server.");
|
||||||
|
:local MailHost $MailServer;
|
||||||
|
:if ([ :typeof [ :toip $MailHost ] ] != "ip" ) do={
|
||||||
|
:set MailHost [ :resolve $MailServer ];
|
||||||
|
}
|
||||||
|
/ tool netwatch add comment=$MailServer host=[ :resolve $MailServer ];
|
||||||
|
}
|
||||||
|
|
||||||
|
:if ([ / tool netwatch get [ find where comment=$MailServer ] status ] = "up") do={
|
||||||
|
:return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
:return false;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue