init script patch
Ivana Varekova <[email protected]>
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <[email protected]> |
/// /I'm going through fedora logwatch patches and this one is not in upstream branch so I'm sending it here. Ivana Hutarova Varekova _______________________________________________ Logwatch-Devel mailing list [email protected] http://www2.list.logwatch.org:81/mailman/listinfo/logwatch-devel
logwatch-init.patch
(text/x-patch, 2.1 KB)
diff -up ./init.ppp ./init
--- ./init.ppp 2009-06-02 15:38:16.000000000 +0200
+++ ./init 2009-06-02 15:40:40.000000000 +0200
@@ -22,9 +22,10 @@
$Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;
while (defined($ThisLine = <STDIN>)) {
- if (( $ThisLine =~ /open\(.*\): No such file or directory/) or
- ( $ThisLine =~ /Id "r" respawning too fast: disabled for 5 minutes/) or
- ( $ThisLine =~ /Re-reading inittab/)) {
+ if (( $ThisLine =~ /open\(.*\): No such file or directory/) or
+ ( $ThisLine =~ /Id "r" respawning too fast: disabled for 5 minutes/) or
+ ( $ThisLine =~ /Re-reading inittab/) or
+ ( $ThisLine =~ /.* main process ended, respawning/)) {
# We don't care about these
}
elsif ( $ThisLine =~ s/Switching to runlevel: (.)\s*$/$1/ ) {
@@ -45,6 +46,12 @@ while (defined($ThisLine = <STDIN>)) {
elsif ( $ThisLine =~ /(\w+) main process \(\d+\) killed by TERM signal/ ) {
$Killed{$1}++;
}
+ elsif ( ($Name, $Status) = ($ThisLine =~ /(.*) main process \([0-9]*\) terminated with status ([0-9]*)/)) {
+ $ProcessTerminated{"$Name,Status"}++;
+ }
+ elsif ( $ThisLine =~ /Re-executing \/sbin\/init/) {
+ $ReExecSbinInit++;
+ }
else {
# report any unmatched entries
push @OtherList,$ThisLine;
@@ -59,12 +66,25 @@ if ((keys %RunLevel) and ($Detail >= 10)
if ($ReExecInit and $Detail) {
print "\n\nRe-execs of init: $ReExecInit times\n";
}
+
+if ($ReExecSbinInit) {
+ print "\n\nRe-executing \/sbin\/init/: $ReExecSbinInit times\n";
+}
+
if ((keys %Killed) and ($Detail >= 10)) {
foreach $Process (sort keys %Killed) {
print " " . $Process . " main process killed by TERM signal : " . $Killed{$Process} . " Time(s)\n";
}
}
+if ((keys %ProcessTerminated) and ($Detail >=10)) {
+ print "\nTerminated processses:\n";
+ foreach (keys %ProcessTerminated) {
+ my ($Name,$Status)=split ",";
+ print " Process " . $Name. " terminated with status " . $Cause . ": " . $ProcessTerminated{"$Name,$Status"} . " Time(s)\n";
+ }
+}
+
if ($#OtherList >= 0) {
print "\n**Unmatched Entries**\n";
print @OtherList;