INN commit: branches/2.5/scripts (3 files)
INN Commit
rra at isc.org
Sun Nov 15 09:30:19 UTC 2009
Date: Sunday, November 15, 2009 @ 01:30:19
Author: iulius
Revision: 8807
news.daily: don't send superfluous mails when "nomail" is given
Make sure that when news.daily is called with "nomail", mail is only
sent when there is real output. Previously, there would always be
headings and empty lines useful to structure the full report, which are
now ommitted.
Also, postexec has been moved up to be included in the regular mail,
and the "nomail" definition of ${MAIL} is no longer overwritten with
the default.
Thanks to Florian Schlichting for this patch.
Modified:
branches/2.5/scripts/innreport.in
branches/2.5/scripts/news.daily.in
branches/2.5/scripts/scanlogs.in
---------------+
innreport.in | 4 +++-
news.daily.in | 50 +++++++++++++++++++++++++++++++-------------------
scanlogs.in | 12 ++++++++----
3 files changed, 42 insertions(+), 24 deletions(-)
Modified: innreport.in
===================================================================
--- innreport.in 2009-11-15 09:30:08 UTC (rev 8806)
+++ innreport.in 2009-11-15 09:30:19 UTC (rev 8807)
@@ -2073,7 +2073,9 @@
$Title =~ s/\&/&/go;
$Title =~ s/\</</go;
$Title =~ s/\>/>/go;
- print "$Title from $first_date to $last_date\n\n";
+ print "$Title from $first_date to $last_date\n\n"
+ if ((defined $$h{'default'}{'text'})
+ and ($$h{'default'}{'text'} =~ m/^true$/io));
}
if ($HTML) {
Modified: news.daily.in
===================================================================
--- news.daily.in 2009-11-15 09:30:08 UTC (rev 8806)
+++ news.daily.in 2009-11-15 09:30:19 UTC (rev 8807)
@@ -146,8 +146,8 @@
DOLOGS=false
;;
Xnomail)
- DOMAIL=false
- MAIL="cut -c 1-1022 | ${SED} -e 's/^~/~~/'"
+ DOMAIL=false
+ DOSTAT=false
;;
Xnoprocbatch)
DOPROCBATCH=false
@@ -184,8 +184,12 @@
else
MAILSUBJ="${HOSTNAME} intermediate Usenet report for ${DATE}"
fi
-MAIL="cut -c 1-1022 | ${SED} -e 's/^~/~~/' | \
- ${MAILCMD} -s '$MAILSUBJ' ${NEWSMASTER}"
+if ${DOMAIL} ; then
+ MAIL="cut -c 1-1022 | ${SED} -e 's/^~/~~/' | \
+ ${MAILCMD} -s '${MAILSUBJ}' ${NEWSMASTER}"
+else
+ MAIL="cut -c 1-1022 | ${SED} -e 's/^~/~~/'"
+fi
## Sanity check. Shouldn't we just bail out here with an error
## instead of trying to patch things up?
@@ -272,14 +276,18 @@
## Run any user programs.
if [ -n "${PROGRAMS}" ] ; then
for P in ${PROGRAMS} ; do
- echo ''
- echo "${P}:"
- eval ${P}
+ if ${DOMAIL} ; then
+ echo ''
+ echo "${P}:"
+ fi
+ eval ${P}
done
fi
${DOLOGS} && {
- echo ''
+ if ${DOMAIL} ; then
+ echo ''
+ fi
scanlogs ${SCANARG}
}
@@ -491,8 +499,10 @@
## Renumber the active file.
if ${DORENUMBER} ; then
- echo ''
- echo 'Renumbering active file.'
+ if ${DOMAIL} ; then
+ echo ''
+ echo 'Renumbering active file.'
+ fi
if [ -z "${RENUMBER}" ] ;then
ctlinnd -s -t`wc -l <${ACTIVE}` renumber '' 2>&1
else
@@ -520,6 +530,17 @@
echo ''
}
+## Run any user programs.
+if [ -n "${POSTPROGRAMS}" ] ; then
+ for P in ${POSTPROGRAMS} ; do
+ if ${DOMAIL} ; then
+ echo ''
+ echo "${P}:"
+ fi
+ eval ${P}
+ done
+fi
+
## Mail the report.
if ${DOMAIL} ; then
## Stop using the temp file, and mail captured output.
@@ -529,15 +550,6 @@
rm -f ${TEMP}
fi
-## Run any user programs.
-if [ -n "${POSTPROGRAMS}" ] ; then
- for P in ${POSTPROGRAMS} ; do
- echo ''
- echo "${P}:"
- eval ${P}
- done
-fi
-
## All done
if ${DAILY} ; then
date >${PATHDB}/.news.daily
Modified: scanlogs.in
===================================================================
--- scanlogs.in 2009-11-15 09:30:08 UTC (rev 8806)
+++ scanlogs.in 2009-11-15 09:30:19 UTC (rev 8807)
@@ -266,12 +266,16 @@
## and summarize syslog information.
BASE=`basename ${SYSLOG_NOTICE}`
OLD_SYSLOG=${OLD}/${BASE}.0
+INNREPORT=${TMPDIR}/innreport$$
if [ -s ${OLD_SYSLOG} -o -s ${OLD_LOG} ] ; then
- ${PATHBIN}/innreport -f ${PATHETC}/innreport.conf ${OLD_SYSLOG} ${OLD_LOG}
- echo ---------
- echo ''
+ ${PATHBIN}/innreport -f ${PATHETC}/innreport.conf ${OLD_SYSLOG} ${OLD_LOG} > ${INNREPORT}
+ if [ -s ${INNREPORT} ] ; then
+ cat ${INNREPORT}
+ echo ---------
+ echo ''
+ fi
fi
-rm -f ${OLD_LOG} ${OLD_SYSLOG}
+rm -f ${OLD_LOG} ${OLD_SYSLOG} ${INNREPORT}
## Now that innreport has finished, we can move unwanted.log. This
## file is not reset because it keeps the count of unwanted newsgroups.
More information about the inn-committers
mailing list