Comment 8 for bug 558178

Revision history for this message
tgc99 (tgc99) wrote :

Logged In: YES
user_id=1159458

ps output on solaris is full of whitespace but a further
echo get's rid of it.
The lines in the smtp log are sometimes broken up by a
newline (right before the msgid) which throws of the
summary. Piping it through sed first will rejoin the broken
lines.
Use $AWK instead of awk.

Patch inserted below:
--- mmdsr.orig 2005-10-19 09:42:30.000000000 +0200
+++ mmdsr 2005-10-19 09:44:23.000000000 +0200
@@ -203,7 +203,8 @@
 # there is an easier cross-platform way to do it,
please let me know.
 ###############################################################################

-MYUID=`$PS -o user -p $$ | $TAIL -1`
+GRABUID=`$PS -o user -p $$ | $TAIL -1`
+MYUID=`echo $GRABUID`
 RUNAS="mailman"

 ###############################################################################
@@ -254,7 +255,7 @@
     $TOUCH $TMPLOG
     echo "Log file: $LOG" >> $TMP
     echo "==============================" >> $TMP
- $GREP -si "^$DAY [0-9][0-9:]* $YEAR" $LOGDIR/$LOG >>
$TMPLOG
+ $SED -e :a -e '$!N;s/\n //;ta' -e 'P;D' $LOGDIR/$LOG |
$GREP -si "^$DAY [0-9][0-9:]* $YEAR" >> $TMPLOG

     if [ -f "$LOGDIR/${LOG}" ] ; then

@@ -264,7 +265,7 @@
            echo "Hourly Summary of Posts" >> $TMP
            echo "-----------------------" >> $TMP

- $SED -e 's/^[A-Z][a-z][a-z] *[0-9]* //' -e
's/:.*$//' $TMPLOG | $UNIQ -c | $SORT -n +1 | awk '{ printf(
"%8d %02d:00-%02d
:59\n", $1, $2, $2 ) }' >> $TMP
+ $SED -e 's/^[A-Z][a-z][a-z] *[0-9]* //' -e
's/:.*$//' $TMPLOG | $UNIQ -c | $SORT -n +1 | $AWK '{
printf( "%8d %02d:00-%02
d:59\n", $1, $2, $2 ) }' >> $TMP

            echo "" >> $TMP
            echo "Post Count by List" >> $TMP
@@ -295,7 +296,7 @@
            echo "" >> $TMP
            echo "Hourly Summary of Messages Sent" >> $TMP
            echo "-------------------------------" >> $TMP
- $SED -e 's/^[A-Z][a-z][a-z] *[0-9]* //' -e
's/:.* for / /' -e 's/ recips,.*$//' $TMPLOG | awk '{
val=int($1); sum[val]+=$2
 } END { for (i=0; i<24; i++) { printf "%8d
%02d:00-%02d:59\n", sum[i], i, i } }' >> $TMP
+ $SED -e 's/^[A-Z][a-z][a-z] *[0-9]* //' -e
's/:.* for / /' -e 's/ recips,.*$//' $TMPLOG | $AWK '{
val=int($1); sum[val]+=$
2 } END { for (i=0; i<24; i++) { printf "%8d
%02d:00-%02d:59\n", sum[i], i, i } }' >> $TMP

        else