mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: rename internal function: $TimeIsSync -> $IsTimeSync
This commit is contained in:
parent
9aa82316c8
commit
b1ad89b1b5
|
@ -34,6 +34,7 @@
|
||||||
:global IfThenElse;
|
:global IfThenElse;
|
||||||
:global IsDefaultRouteReachable;
|
:global IsDefaultRouteReachable;
|
||||||
:global IsDNSResolving;
|
:global IsDNSResolving;
|
||||||
|
:global IsTimeSync;
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global MkDir;
|
:global MkDir;
|
||||||
:global NotificationFunctions;
|
:global NotificationFunctions;
|
||||||
|
@ -51,7 +52,6 @@
|
||||||
:global SendNotification2;
|
:global SendNotification2;
|
||||||
:global SymbolByUnicodeName;
|
:global SymbolByUnicodeName;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global TimeIsSync;
|
|
||||||
:global UrlEncode;
|
:global UrlEncode;
|
||||||
:global ValidateSyntax;
|
:global ValidateSyntax;
|
||||||
:global VersionToNum;
|
:global VersionToNum;
|
||||||
|
@ -323,13 +323,13 @@
|
||||||
:global EmailQueue;
|
:global EmailQueue;
|
||||||
|
|
||||||
:global EitherOr;
|
:global EitherOr;
|
||||||
|
:global IsTimeSync;
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global TimeIsSync;
|
|
||||||
|
|
||||||
:local AllDone true;
|
:local AllDone true;
|
||||||
:local QueueLen [ :len $EmailQueue ];
|
:local QueueLen [ :len $EmailQueue ];
|
||||||
|
|
||||||
:if ([ $TimeIsSync ] = false) do={
|
:if ([ $IsTimeSync ] = false) do={
|
||||||
$LogPrintExit2 debug $0 ("Time is not synced, not flushing.") false;
|
$LogPrintExit2 debug $0 ("Time is not synced, not flushing.") false;
|
||||||
:return false;
|
:return false;
|
||||||
}
|
}
|
||||||
|
@ -462,6 +462,34 @@
|
||||||
:return true;
|
:return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check if system time is sync
|
||||||
|
:set IsTimeSync do={
|
||||||
|
:global LogPrintExit2;
|
||||||
|
|
||||||
|
:if ([ /system/ntp/client/get enabled ] = true) do={
|
||||||
|
:do {
|
||||||
|
:if ([ /system/ntp/client/get status ] = "synchronized") do={
|
||||||
|
:return true;
|
||||||
|
}
|
||||||
|
} on-error={
|
||||||
|
:if ([ :typeof [ /system/ntp/client/get last-adjustment ] ] = "time") do={
|
||||||
|
:return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
:return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
:if ([ /ip/cloud/get ddns-enabled ] = true && [ /ip/cloud/get update-time ] = true) do={
|
||||||
|
:if ([ :typeof [ /ip/cloud/get public-address ] ] = "ip") do={
|
||||||
|
:return true;
|
||||||
|
}
|
||||||
|
:return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$LogPrintExit2 debug $0 ("No time source configured! Returning gracefully...") false;
|
||||||
|
:return true;
|
||||||
|
}
|
||||||
|
|
||||||
# log and print with same text, optionally exit
|
# log and print with same text, optionally exit
|
||||||
:set LogPrintExit2 do={
|
:set LogPrintExit2 do={
|
||||||
:local Severity [ :tostr $1 ];
|
:local Severity [ :tostr $1 ];
|
||||||
|
@ -1110,34 +1138,6 @@
|
||||||
:return ($Return . " ");
|
:return ($Return . " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if system time is sync
|
|
||||||
:set TimeIsSync do={
|
|
||||||
:global LogPrintExit2;
|
|
||||||
|
|
||||||
:if ([ /system/ntp/client/get enabled ] = true) do={
|
|
||||||
:do {
|
|
||||||
:if ([ /system/ntp/client/get status ] = "synchronized") do={
|
|
||||||
:return true;
|
|
||||||
}
|
|
||||||
} on-error={
|
|
||||||
:if ([ :typeof [ /system/ntp/client/get last-adjustment ] ] = "time") do={
|
|
||||||
:return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
:return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
:if ([ /ip/cloud/get ddns-enabled ] = true && [ /ip/cloud/get update-time ] = true) do={
|
|
||||||
:if ([ :typeof [ /ip/cloud/get public-address ] ] = "ip") do={
|
|
||||||
:return true;
|
|
||||||
}
|
|
||||||
:return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$LogPrintExit2 debug $0 ("No time source configured! Returning gracefully...") false;
|
|
||||||
:return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
# url encoding
|
# url encoding
|
||||||
:set UrlEncode do={
|
:set UrlEncode do={
|
||||||
:local Input [ :tostr $1 ];
|
:local Input [ :tostr $1 ];
|
||||||
|
@ -1256,9 +1256,9 @@
|
||||||
|
|
||||||
# wait for time to become synced
|
# wait for time to become synced
|
||||||
:set WaitTimeSync do={
|
:set WaitTimeSync do={
|
||||||
:global TimeIsSync;
|
:global IsTimeSync;
|
||||||
|
|
||||||
:while ([ $TimeIsSync ] = false) do={
|
:while ([ $IsTimeSync ] = false) do={
|
||||||
:delay 1s;
|
:delay 1s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue