Skip to content

Commit 6822e71

Browse files
eworm-demgisbers
andcommitted
netwatch-notify: cache the result
If this script runs from terminal this will not change... 😜 So cache the result. Co-authored-by: Michael Gisbers <[email protected]>
1 parent a0163aa commit 6822e71

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

netwatch-notify

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252

5353
$ScriptLock $0;
5454

55+
:local ScriptFromTerminalCached [ $ScriptFromTerminal $0 ];
56+
5557
:if ([ /system/resource/get uptime ] < 5m) do={
5658
$LogPrintExit2 info $0 ("System just booted, giving netwatch some time to settle.") true;
5759
}
@@ -145,7 +147,7 @@ $ScriptLock $0;
145147
}
146148
}
147149
:if ($Metric->"notified" = false || $Metric->"count-down" % 120 = 0 || \
148-
[ $ScriptFromTerminal $0 ] = true) do={
150+
$ScriptFromTerminalCached = true) do={
149151
$LogPrintExit2 [ $IfThenElse ($HostInfo->"no-down-notification" != true) info debug ] $0 \
150152
("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is down for " . \
151153
$Metric->"count-down" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \

0 commit comments

Comments
 (0)