From e364858336a05ec5750580aa4bfb2558af662637 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 22 Jan 2007 13:19:09 +0000 Subject: fewer alert repeats --- it.class | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index bb61397..149ec04 100644 --- a/it.class +++ b/it.class @@ -67,6 +67,7 @@ function timerlog($label = '') * @param $to (optional) comma separated recipient list * @param named parameter id identifier of error. if given, only subsequent errors of same id will trigger message * @param named parameter timewindow number of seconds within which the second error must occur + * @param named parameter interval minimum number of seconds between alerts */ function error($p = array(), $body = "", $to = "") { @@ -82,7 +83,7 @@ function error($p = array(), $body = "", $to = "") $p = array(); } - $p += array('timewindow' => 25*3600); + $p += array('timewindow' => 25*3600, 'interval' => 6*3600); if (!$to) $to = strtr(trim(@file_get_contents($GLOBALS['ULTRAHOME'] . "/.diffnotice")), array("\n"=>',', ' '=>'')); @@ -115,7 +116,7 @@ function error($p = array(), $body = "", $to = "") } else { - $cmd = "alert -l " . escapeshellarg($to) . " 4 " . escapeshellarg($title); + $cmd = "alert -l -i " . escapeshellarg($p['interval']) ." " . escapeshellarg($to) . " 4 " . escapeshellarg($title); EDC('exec', $cmd); if (($pipe = popen($cmd, "w"))) -- cgit v1.2.3