Blob Blame History Raw
Add '--no-oldfiles-log' option that suppresses a warning about old files in the
logwatch temporary directory.

Author: Ivana Varekova <varekova@redhat.com>
RH-Bugzilla: #230974
Backported-By: Jan Synacek <jsynacek@redhat.com>

--- logwatch-svn198/logwatch.8	2014-01-26 13:46:02.000000000 +0100
+++ logwatch-svn198/logwatch.8	2014-07-04 10:03:26.870415276 +0200
@@ -35,7 +35,7 @@
 .I report format
 .B ] [--encode
 .I encoding to use
-.B ] [--numeric] [--version] [--help|--usage]
+.B ] [--numeric] [--no-oldfiles-log] [--version] [--help|--usage]
 .SH DESCRIPTION
 .B Logwatch
 is a customizable, pluggable log-monitoring system.  It will go
@@ -111,6 +111,9 @@
 Number of characters that html output should be wrapped to. Default is 80.
 .IP "\fB--numeric\fR"
 Inhibits additional name lookups, displaying IP addresses numerically.
+.IP "\fB--no-oldfiles-log\fR"
+Suppress the logwatch log, which informs about the
+old files in logwatch tmpdir.
 .IP "\fB--usage\fR"
 Displays usage information
 .IP "\fB--help\fR"
--- logwatch-svn198/scripts/logwatch.pl	2014-07-04 10:02:23.930302006 +0200
+++ logwatch-svn198/scripts/logwatch.pl	2014-07-04 10:05:01.588585717 +0200
@@ -187,6 +187,7 @@
 my @TempServiceList = ();
 my $Help = 0;
 my $ShowVersion = 0;
+my $NoOldfilesLog = 0;
 my ($tmp_mailto, $tmp_savefile);
 
 &GetOptions ("d|detail=s"   => \$Config{'detail'},
@@ -209,6 +210,7 @@
              "hostformat=s" => \$Config{'hostformat'},
              "hostlimit=s"  => \$Config{'hostlimit'},
              "html_wrap=s"  => \$Config{'html_wrap'},
+             "no-oldfiles-log" => \$NoOldfilesLog,
              "subject=s"    => \$Config{'subject'}
            ) or &Usage();
 
@@ -632,7 +634,7 @@
 opendir(TMPDIR, $Config{'tmpdir'}) or die "$Config{'tmpdir'} $!";
 my @old_dirs = grep { /^logwatch\.\w{8}$/ && -d "$Config{'tmpdir'}/$_" }
    readdir(TMPDIR);
-if (@old_dirs) {
+if ((@old_dirs) && ($NoOldfilesLog==0)) {
    print "You have old files in your logwatch tmpdir ($Config{'tmpdir'}):\n\t";
    print join("\n\t", @old_dirs);
    print "\nThe directories listed above were most likely created by a\n";
@@ -1085,7 +1087,7 @@
 sub Usage () {
    # Show usage for this program
    print "\nUsage: $0 [--detail <level>] [--logfile <name>] [--output <output_type>]\n" .
-      "   [--format <format_type>] [--encode <enconding>] [--numeric]\n" .
+      "   [--format <format_type>] [--encode <enconding>] [--numeric] [--no-oldfiles-log]\n" .
       "   [--mailto <addr>] [--archives] [--range <range>] [--debug <level>]\n" .
       "   [--filename <filename>] [--help|--usage] [--version] [--service <name>]\n" .
       "   [--hostformat <host_format type>] [--hostlimit <host1,host2>] [--html_wrap <num_characters>]\n\n";
@@ -1096,6 +1098,8 @@
    print "--output <output type>: Report Output - stdout [default], mail, file.\n"; #8.0
    print "--format <formatting>: Report Format - text [default], html.\n"; #8.0
    print "--encode <encoding>: Enconding to use - none [default], base64.\n"; #8.0
+   print "--no-oldfiles-log: Suppress the logwatch log, which informs about the\n";
+   print "                   old files in logwatch tmpdir.\n";
    print "--mailto <addr>: Mail report to <addr>.\n";
    print "--archives: Use archived log files too.\n";
    print "--filename <filename>: Used to specify they filename to save to. --filename <filename> [Forces output to file].\n";