From: David Rosenthal <davidr@shamash.org>
moderated tag question

NOTES from author:

Right now listproc doesn't allow you to get a list of pending messages for
a moderated-no-edit list, EXCEPT via the web interface (lp-web).  Since I
have other concerns about the web interface, I wrote a script which
generates the list of pending messages for such lists.  I then put it in
crontab and have it send out on a regular basis to the listowner the list
of pending messages. (if the listowner wants it.... they usually do want
this info)

Here is the example crontab entry:

0 22 * * 0,3,5 /var/adm/bin/listproc.moderated.pending example | mail -s
"Pending msgs for the Example list" example-request

Replace "example" in all cases with the name of the list.

Here is the example output:
----BEGIN EXAMPLE ONE---
Date: Fri Nov  6 18:04:59 EST 1998
Messages Pending for the moderated-no-edit list EXAMPLE
(You must replace LISTPASSWORD with your list owners password)

approve EXAMPLE LISTPASSWORD &
1 2 4 5 6 7 8 9 10 11 &
12 13 14 15 16 17 18 19 20 21 &
22 23 26 27 28 29 31 32 33 35 &
84 101
----END EXAMPLE ONE----

Version 1.1 of the script also created a quiet mode which creates output 
which looks like this when called with the syntax:
                  track_moderated example quiet
This should be helpful for more succinct output, which may be desired if 
the listowner puts this into their .profile or .login script (if their 
account is on the same machine as the ListProcessor).

----BEGIN EXAMPLE TWO---
Messages pending for EXAMPLE:
1 2 4 5 6 7 8 9 10 11 &
12 13 14 15 16 17 18 19 20 21 &
22 23 26 27 28 29 31 32 33 35 &
84 101
----END EXAMPLE TWO----

Here is the script I use to generate the output:

#!/bin/bash
# listproc.moderated.pending 
###############################################################
# This script shows what message ID's are pending 
# for a moderated-no-edit list.  You can run it interactively
# You can run it via cron and pipe the results to a listowner 
###############################################################
# Bug: If you don't run bash, your shell may handle "echo -n" 
#       differently.  
###############################################################
# By: David Rosenthal <davidr@shamash.org>
# Date: June 2, 1998
###############################################################
# Version 1.1 7-20-99 quiet mode added
###############################################################

##Define Variables -- Edit this section
# Where is Listproc installed
LPDIR="/var/listproc"

###############################################################
# No editing should be required below here
###############################################################

## Check for the arguments required
if [ "$1" = "" ] ; then
 echo "Usage: $0 <listname> [quiet]"
 echo "This script shows what messages are pending for moderated-no-edit lists"
 exit
fi 

## You shouldn't have to change these variables
perrow=10
LISTNAME=`echo $1 | tr [:lower:] [:upper:]`
count=0

## Do the quiet mode
if [ "$2" = "quiet" ] ; then
  ## Obtain and display the pending message-tags
  if [ -r $LPDIR/lists/$LISTNAME/moderated ] ; then
   TAGLIST=`grep "Message-Tag" $LPDIR/lists/$LISTNAME/moderated | cut -d " " -f2`
   if [ "$TAGLIST" != "" ] ; then
     echo "Messages pending for $LISTNAME:"
     for TAG in $TAGLIST ; do
      count=`expr $count + 1`
      echo -n "$TAG"
      if [ $count -lt $perrow ] ; then
       echo -n " "
      else
       echo " &"
       count=0
      fi
     done
     echo 
   else
     echo "No messages pending for $LISTNAME"
   fi
  else 
   echo "Cannot read $LPDIR/lists/$LISTNAME/moderated"
  fi
  exit
fi

## Do the verbose mode
## Print some header information
echo -n "Date: " 
date

## Obtain and display the pending message-tags
if [ -r $LPDIR/lists/$LISTNAME/moderated ] ; then
 TAGLIST=`grep "Message-Tag" $LPDIR/lists/$LISTNAME/moderated | cut -d " " -f2`
 if [ "$TAGLIST" != "" ] ; then
   echo "Messages Pending for the moderated-no-edit list $LISTNAME"
   echo "(You must replace LISTPASSWORD with your list owners password)"
   echo
   echo "approve $LISTNAME LISTPASSWORD &"
   for TAG in $TAGLIST ; do
    count=`expr $count + 1`
    echo -n "$TAG"
    if [ $count -lt $perrow ] ; then
     echo -n " "
    else 
     echo " &"
     count=0
    fi
   done
   echo
 else
   echo "No messages pending for $LISTNAME"
 fi
else 
 echo "Cannot read $LPDIR/lists/$LISTNAME/moderated"
fi

