diff options
author | Christian Hesse <mail@eworm.de> | 2022-10-21 09:07:50 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2022-10-21 15:00:42 +0200 |
commit | 6822e715646833efc3a0018ffe0e840dc8371715 (patch) | |
tree | a9b4e9707dd9c5e8c9d4ed4a41bb462af7ac4e91 /netwatch-notify | |
parent | a0163aa487df214d3f86428c7f93266a88ed3ab8 (diff) |
netwatch-notify: cache the result
If this script runs from terminal this will not change... 😜
So cache the result.
Co-authored-by: Michael Gisbers <michael@gisbers.de>
Diffstat (limited to 'netwatch-notify')
-rw-r--r-- | netwatch-notify | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/netwatch-notify b/netwatch-notify index e37fc36..7a0766c 100644 --- a/netwatch-notify +++ b/netwatch-notify @@ -52,6 +52,8 @@ $ScriptLock $0; +:local ScriptFromTerminalCached [ $ScriptFromTerminal $0 ]; + :if ([ /system/resource/get uptime ] < 5m) do={ $LogPrintExit2 info $0 ("System just booted, giving netwatch some time to settle.") true; } @@ -145,7 +147,7 @@ $ScriptLock $0; } } :if ($Metric->"notified" = false || $Metric->"count-down" % 120 = 0 || \ - [ $ScriptFromTerminal $0 ] = true) do={ + $ScriptFromTerminalCached = true) do={ $LogPrintExit2 [ $IfThenElse ($HostInfo->"no-down-notification" != true) info debug ] $0 \ ("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is down for " . \ $Metric->"count-down" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \ |