--- omni2db.pl 2002/09/14 12:15:20 1.6 +++ omni2db.pl 2003/10/05 10:12:44 1.7 @@ -62,22 +62,26 @@ } open(O, "/usr/omni/bin/omnistat -detail |") || die "omnistat: $!"; -while() { - chomp; - if (/^$/) { - db(); - %omni = (); - print "------------\n" if ($debug); - next; - } - s/^[\t\s]+//; - my ($l,$r) = split (/\s*:\s*/,$_,2); - if ($r) { - $l =~ s/\s+/_/g; - $r =~ s/\s+$//g; - print "$l -> $r\n" if ($debug); - $omni{$l} = $r; +if (!eof(O)) { + # somehow, from time to time omnistats dies before we get here + # this is a workaround to keep cron e-mails from reporting it. + while() { + chomp; + if (/^$/) { + db(); + %omni = (); + print "------------\n" if ($debug); + next; + } + s/^[\t\s]+//; + my ($l,$r) = split (/\s*:\s*/,$_,2); + if ($r) { + $l =~ s/\s+/_/g; + $r =~ s/\s+$//g; + print "$l -> $r\n" if ($debug); + $omni{$l} = $r; + } } + db(); + close(O); } -db(); -close(O);