diff -r 3243849b73c6 -r 7646f39cf5cc check_rsnapshot.pl --- a/check_rsnapshot.pl Tue Mar 26 10:31:41 2013 +0100 +++ b/check_rsnapshot.pl Tue Mar 26 11:28:02 2013 +0100 @@ -112,11 +112,11 @@ and exit $ERRORS{CRITICAL}; while ($gz->gzreadline($_) > 0) { next unless (/^\[$date/); + $found_in_file = $logfile; if (/^\[$date:.*ERROR/) { $error = $_; last; } - $found_in_file = $logfile; } print "RSNAPSHOT CRITICAL: Error reading from $logfile: $gzerrno\n" and exit $ERRORS{CRITICAL} @@ -127,12 +127,12 @@ or print "RSNAPSHOT CRITICAL: $logfile - $!\n" and exit $ERRORS{CRITICAL}; while () { + $found_in_file = $logfile; next unless (/^\[$date/); if (/^\[$date:.*ERROR/) { $error = $_; last; } - $found_in_file = $logfile; } close(FH); } @@ -141,9 +141,7 @@ } - unless ($found_in_file) { - $error = "can't find rsnapshot run from [$date]\n"; - } + $error |= "can't find rsnapshot run from [$date]\n" unless ($found_in_file); if ($error) { print "RSNAPSHOT CRITICAL: $error";