/[smecontribs]/rpms/smeserver-mailstats/contribs10/smeserver-mailstats-1.1-Take-out-dot-in-cron-file-and-also-re-direct-errors-to-syslog.patch
ViewVC logotype

Contents of /rpms/smeserver-mailstats/contribs10/smeserver-mailstats-1.1-Take-out-dot-in-cron-file-and-also-re-direct-errors-to-syslog.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Fri Apr 2 11:11:43 2021 UTC (3 years, 7 months ago) by brianr
Branch: MAIN
CVS Tags: smeserver-mailstats-1_1-16_el7_sme, smeserver-mailstats-1_1-17_el7_sme, HEAD
* Fri Apr 02 2021 Brian Read <brianr@bjsystems.co.uk> 1.1-16.sme
- Take out dot in cron file and also re-direct errors to syslog [SME: 11519]

1 diff -urN smeserver-mailstats-1.1.old/root/etc/cron.d/mailstats smeserver-mailstats-1.1/root/etc/cron.d/mailstats
2 --- smeserver-mailstats-1.1.old/root/etc/cron.d/mailstats 1970-01-01 01:00:00.000000000 +0100
3 +++ smeserver-mailstats-1.1/root/etc/cron.d/mailstats 2021-04-02 10:20:03.578882758 +0100
4 @@ -0,0 +1 @@
5 +0 0 * * * root sleep $[ $RANDOM \% 3600 ]; /usr/bin/runmailstats.sh
6 diff -urN smeserver-mailstats-1.1.old/root/etc/cron.d/mailstats.cron smeserver-mailstats-1.1/root/etc/cron.d/mailstats.cron
7 --- smeserver-mailstats-1.1.old/root/etc/cron.d/mailstats.cron 2021-04-02 10:01:02.017494160 +0100
8 +++ smeserver-mailstats-1.1/root/etc/cron.d/mailstats.cron 1970-01-01 01:00:00.000000000 +0100
9 @@ -1,2 +0,0 @@
10 -0 0 * * * root sleep $[ $RANDOM \% 3600 ]; perl /usr/bin/mailstats.pl /var/log/qpsmtpd/\@* /var/log/qpsmtpd/current /var/log/sqpsmtpd/\@* /var/log/sqpsmtpd/current
11 -
12 diff -urN smeserver-mailstats-1.1.old/root/usr/bin/mailstats.pl smeserver-mailstats-1.1/root/usr/bin/mailstats.pl
13 --- smeserver-mailstats-1.1.old/root/usr/bin/mailstats.pl 2021-04-02 10:01:02.026494244 +0100
14 +++ smeserver-mailstats-1.1/root/usr/bin/mailstats.pl 2021-04-02 12:02:01.776104517 +0100
15 @@ -1,4 +1,5 @@
16 -#!/usr/bin/perl -w
17 +#!/usr/bin/perl
18 +use strict;
19
20 #############################################################################
21 #
22 @@ -13,7 +14,7 @@
23 # - Sort out geoip failure status as per Bug 4262
24 # - change final message about the DB (it is created automatically these days by the rpm)
25 # bjr - 17Jun15 - Add annotation showing Badcountries being eliminated
26 -# - correct Spamfilter details extract, as per Bug 8656
27 +# - correct Spamfilter details extract, as per Bug 8656
28 # - Add analysis table of Geoip results
29 # bjr - 19Jun15 - Add totals for the League tables
30 # bjr and Unnilennium - 08Apr16 - Add in else for unrecognised plugin detection
31 @@ -30,6 +31,7 @@
32 # bjr - 18Dec19 - Sort out a few format problems and also remove some debugging crud - Bug 10858
33 # bjr - 18Dec19 - change to fix truncation of email address in by email table - bug 10327
34 # bjr - 18Oct20 - Alter use of lc to avoid uninitialised messages - bug 11044
35 +# bjr - 02Apr21 - Fix up lc to try to avoif uninit messages - and alter warning status - bug 11519
36 #
37 #############################################################################
38 #
39 @@ -102,7 +104,7 @@
40
41 #Configuration section
42 my %opt = (
43 - version => '0.7.14', # please update at each change.
44 + version => '0.7.15', # please update at each change.
45 debug => 0, # guess what ?
46 sendmail => '/usr/sbin/sendmail', # Path to sendmail stub
47 from => 'spamfilter-stats', # Who is the mail from
48 @@ -386,7 +388,7 @@
49 $counts{$PERCENT}{$categs[$ncateg]} = 0;
50
51 if ($cdb->get('mailstats')){
52 - $display[$ncateg] = lc($cdb->get('mailstats')->prop($categs[$ncateg]) || "auto");
53 + $display[$ncateg] = lc($cdb->get_prop('mailstats',$categs[$ncateg]) || "auto");
54 } else {
55 $display[$ncateg] = 'auto'
56 }
57 @@ -783,7 +785,7 @@
58 if ($localflag == 0) {
59 if (length($log_items[4]) > 0){
60 # Need to check here for multiple email addresses
61 - my @emails = split(",",lc($log_items[4]));
62 + my @emails = split(",",lc($log_items[4] || ' '));
63 if (scalar(@emails) > 1) {
64 #Just pick the first local address to hang it on.
65 # TEMP - just go for the first address until I can work out how to spot the 1st "local" one
66 @@ -796,11 +798,13 @@
67 my $fullemail = $email;
68 $email = s/.*\@(.*)$/$1/;
69 #and see if it is local
70 - if ($email =~ m/$alldomains/){
71 - $usercounts{lc($fullemail)}{$result}++;
72 - $usercounts{lc($fullemail)}{"proc"} = $proc;
73 - $gotone = $true;
74 - last;
75 + if (length($fullemail)>0) {
76 + if ($email =~ m/$alldomains/){
77 + $usercounts{lc($fullemail || ' ')}{$result}++;
78 + $usercounts{lc($fullemail || ' ')}{"proc"} = $proc;
79 + $gotone = $true;
80 + last;
81 + }
82 }
83 }
84 if (!$gotone) {
85 diff -urN smeserver-mailstats-1.1.old/root/usr/bin/runmailstats.sh smeserver-mailstats-1.1/root/usr/bin/runmailstats.sh
86 --- smeserver-mailstats-1.1.old/root/usr/bin/runmailstats.sh 1970-01-01 01:00:00.000000000 +0100
87 +++ smeserver-mailstats-1.1/root/usr/bin/runmailstats.sh 2021-04-02 10:12:16.681578199 +0100
88 @@ -0,0 +1,3 @@
89 +#!/bin/bash
90 +exec 1> >(logger -t $(basename $0)) 2>&1
91 +perl /usr/bin/mailstats.pl /var/log/qpsmtpd/\@* /var/log/qpsmtpd/current /var/log/sqpsmtpd/\@* /var/log/sqpsmtpd/current

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed