[Logwatch-Devel] some cron tweaks

Bob Hutchinson hutchlists at midwales.com
Tue Jan 31 03:55:13 MST 2006


I've had a few unmatched lines under cron on Debian boxes
here is a patch for /usr/share/logwatch/scripts/services
Also attached as cron.diff

ignore rsyncd entries
collect information from ntpdate entries

--- scripts/services/cron.org	2006-01-24 10:45:49.000000000 +0000
+++ scripts/services/cron	2006-01-30 13:17:47.000000000 +0000
@@ -76,6 +76,7 @@
    if ( 
       ($ThisLine =~ /Updated timestamp for job/) or
       ($ThisLine =~ /INFO \(pidfile fd = \d+\)/) or
+      ($ThisLine =~ /rsyncd/) or
       ($ThisLine =~ /INFO \(Running \@reboot jobs\)/)
    ) {
       # Ignore
@@ -145,6 +146,12 @@
       $UserReloads{$User}++;
    } elsif ( $ThisLine =~ /.*?: fcron.* started/) {
       $Startups++;
+   } elsif ( ($offset) = ($ThisLine =~ /ntpdate\[\d+\]: adjust time server .* 
offset (.*) sec/)) {
+      $Ntpdate++;
+	  if ( $ntpdateminoffset > $offset ) { $ntpdateminoffset = $offset; }
+	  if ( $ntpdatemaxoffset < $offset ) { $ntpdatemaxoffset = $offset; }
+   } elsif ($ThisLine =~ /ntpdate\[\d+\]: no server suitable for 
synchronization found/) {
+     $ntpdatenosync++;
    } else {
       # Report any unmatched entries...
       push @OtherList, "$ThisLine\n";
@@ -216,6 +222,16 @@
    }
 }
 
+if ($Ntpdate) {
+   print "\nNtpdate: adjusted $Ntpdate times\n";
+   print "\tMinimum offset $ntpdateminoffset\n";
+   print "\tMaximum offset $ntpdatemaxoffset\n";
+}
+
+if($ntpdatenosync) {
+   print "\nNtpDate could not sync: $ntpdatenosync times\n";
+}
+
 if ($#OtherList >= 0) {
    print "\n**Unmatched Entries**\n";
    print @OtherList;

-- 
-----------------
Bob Hutchinson
Midwales dot com
-----------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cron.diff
Type: text/x-diff
Size: 1350 bytes
Desc: not available
Url : http://ip70-176-100-107.ph.ph.cox.net/pipermail/logwatch-devel/attachments/20060131/2f2c6cab/cron.bin


More information about the Logwatch-Devel mailing list