global-functions: introduce function $IsFullyConnected

This commit is contained in:
Christian Hesse 2022-06-17 00:10:51 +02:00
parent b1ad89b1b5
commit d8d7ace5e5

View file

@ -34,6 +34,7 @@
:global IfThenElse; :global IfThenElse;
:global IsDefaultRouteReachable; :global IsDefaultRouteReachable;
:global IsDNSResolving; :global IsDNSResolving;
:global IsFullyConnected;
:global IsTimeSync; :global IsTimeSync;
:global LogPrintExit2; :global LogPrintExit2;
:global MkDir; :global MkDir;
@ -462,6 +463,24 @@
:return true; :return true;
} }
# check if system is is fully connected (default route reachable, DNS resolving, time sync)
:set IsFullyConnected do={
:global IsDefaultRouteReachable;
:global IsDNSResolving;
:global IsTimeSync;
:if ([ $IsDefaultRouteReachable ] = false) do={
:return false;
}
:if ([ $IsDNSResolving ] = false) do={
:return false;
}
:if ([ $IsTimeSync ] = false) do={
:return false;
}
:return true;
}
# check if system time is sync # check if system time is sync
:set IsTimeSync do={ :set IsTimeSync do={
:global LogPrintExit2; :global LogPrintExit2;