New option - DailyReport - enables/disables sending of daily reports by cron
Jan Synacek <[email protected]>
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <063cad95-3064-45a6-9924-015aab46ce3e@zmail11.collab.prod.int.phx2.redhat.com> |
Hello list, I added an option that allows users to specify, if they want logwatch to send daily reports when the script is run by cron. Patches attached. Regards, Jan Synacek ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Logwatch-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/logwatch-devel
logwatch-logwatch.patch
(text/x-patch, 822 B)
--- scripts/logwatch.pl 2012-01-05 13:48:43.412548383 +0100
+++ scripts/logwatch.pl.new 2012-01-05 13:58:16.687311709 +0100
@@ -93,6 +93,7 @@ $Config{'encode'} = "none"; #8.0
$Config{'hostformat'} = "none"; #8.0
$Config{'html_wrap'} = 80;
$Config{'supress_ignores'} = 0;
+$Config{'dailyreport'} = 1;
if (-e "$ConfigDir/conf/html/header.html") {
$Config{'html_header'} = "$ConfigDir/conf/html/header.html";
@@ -181,6 +182,15 @@ if ($Config{'debug'} > 8) {
&PrintConfig();
}
+# Check DailyReport option and react accordingly, if the script is run by cron
+
+if (($ENV{'LOGWATCH_CRON'}) && !($Config{'dailyreport'})) {
+ if ($Config{'debug'} > 5) {
+ print "Logwatch was run by cron, but DailyReport set to No. Exiting.\n";
+ }
+ exit(0);
+}
+
# Options time...
my @TempLogFileList = ();
logwatch-cron.patch
(text/x-patch, 496 B)
--- logwatch.cron 2011-12-19 11:06:41.857109130 +0100 +++ logwatch.cron.new 2012-01-05 13:50:55.141493971 +0100 @@ -6,6 +6,8 @@ LOGWATCH_SCRIPT="/usr/sbin/logwatch" #but some are only for the nightly cronrun such as --output mail and should be set here. #Other options to consider might be "--format html" or "--encode base64", man logwatch for more details. OPTIONS="--output mail" +#Let logwatch know it's run by cron +export LOGWATCH_CRON="yes" #Call logwatch $LOGWATCH_SCRIPT $OPTIONS
logwatch-conf.patch
(text/x-patch, 586 B)
--- conf/logwatch.conf 2011-12-19 11:06:39.298110465 +0100 +++ conf/logwatch.conf.new 2012-01-05 14:05:02.324144274 +0100 @@ -114,6 +114,10 @@ Service = "-eximstats" # Prevents e # From here with out breaking anything. This would allow mail/mailx/nail etc..... -mgt mailer = "/usr/sbin/sendmail -t" +# Enable logwatch daily cron script +# Set to 'No' if you do not wish the cron to send you daily reports +DailyReport = Yes + # # With this option set to 'Yes', only log entries for this particular host # (as returned by 'hostname' command) will be processed. The hostname