procmail
[Top] [All Lists]

Questions on syntax

1995-12-18 01:10:47
I'm going to show off my lack of shell experience here.

I've written a .procmailrc file to archive mailing list postings as they
arrive and make the archives available via the web.  I'm trying to do this
all with a procmailrc file.  The rc file creates a web index page with
links to the individual archived articles.  The links show subject, from,
and date.  The articles are also slightly formatted (also via
.procmailrc) as web pages.  

But I'm stuck on a few problems.  I know a shell script would be easier, 
but I wanted to try to do it all with procmail.  Sorry for the 
long message - but I thought it better to ask for help in one message.



Q) When procmail writes to a directory and creates a unique filename, is 
there an easy way to get the file name?  Currently, I'm using:


  # Write out filtered message to unique file name in archive directory
  :0wc
  archive


  MAILDIR=$MAILDIR/archive  # change dirs to archive dir


  # Extract unique file name just created.

  FILE=`ls -t $MSGPREFIX* | head -1`

to get the name ($FILE) of the last file created (by procmail).  Is there 
a better way to get this file name?



Q) My .procmailrc file is really more of a script at this point.  It does
a number echos, directory listings, and file copies that should be all
completed before .procmail processes another message.  This seems like a 
good use for a lock file.  I try, for example: 

 :0:archive.lock
 * ^From:.*the-mailing-list
 {
    :0c
    archive_dir   # place copy in directory with unique name.

    :0wc
    | echo text to build .html index to archive.....
 
    ...  # more writing and copy operations.

 }  # end of nexting block

But the log file says 'procmail: Extraneous lockfile ignored'.  I want to
make sure that all processing is finished before another message is
processed. 


Q) I want to purge old archived messages when the total archive uses too 
much disk space.  But I can't seem to get the disk space used into a var.

  BLOCKS_USED=`du`              <<-- this works,
  BLOCKS_USED=$BLOCKS_USED[1]   <<-- but this creates a null string???

If I can get this to work I'd use a recipe like:


  :0Wc
  * ? test $BLOCKS_USED -gt $MAXBLOCKS
  | remove oldest archived file and index entry


Thanks very much for any help you can provide.


Bill Moseley
moseley(_at_)netcom(_dot_)com

<Prev in Thread] Current Thread [Next in Thread>