procmail
[Top] [All Lists]

Re: "if" with INCLUDERC - possible?

2005-06-02 08:12:44
On Thu, Jun 02, 2005 at 03:48:31PM +0200, schnitzel meister wrote:
Hello!

I have the following line in .procmailrc for each user:
 INCLUDERC=/var/www/squirrelmail/data/${USER}-spamrc

Unfortunately, procmail complains if the file is missing.

Is there a way to get procmail to ignore this missing file?

You can use test, albeit with a forked process.

  TARGET = "/var/www/squirrelmail/data/${USER}-spamrc"

  :0
  * ? test -s $TARGET
  { INCLUDERC = $TARGET }

However, then you will get results from "test" in your log
instead of what's there now.

You could change the logfile briefly:


 OLDLOGFILE = $LOGFILE
 LOGFILE = /dev/null
 INCLUDERC = $TARGET
 LOGFILE = $OLDLOGFILE

Or you could give everyone dummy $USER-spamrc files of zero length
or linked to /dev/null if they don't have a file already.


 INCLUDERC = $TARGET

shows no errors in the log if $TARGET is really a link to
/dev/null.  So make a script to look for $USER-spamrc, and if it's
not there,


  ln -s /dev/null $USER-spamrc

-- 
dman


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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