procmail
[Top] [All Lists]

Re: procmail and if statements

2002-08-22 11:39:29
On Thu, 22 Aug 2002, Jim Breton wrote:

On Wed, Aug 21, 2002 at 06:48:36PM -0700, Helen McCarthy wrote:
If the time is between 5pm and 7am or if it is a Saturday or a Sunday,
then send an auto-response.

        Two assumptions:
                1)  We are talking about your local time, not the sender time
                    (I would use  "Received: from.*by my.server.here" instead
                    of "From" line)
                2)  You do not want to reject or drop any message - just
                    doing the job out of the rush ours.


                Now try this procedure:

        a>  Put your replay recipe in rcfile; say "replayrc".

        b>  In your procmailrc collect all the messages that need answer
            into one folder:

:0:replay-spool-folder
* Does need answer?
replay-spool-folder


        c>  Run by cron every n min...:

#!/bin/sh
[ -e replay-spool-folder.lock ] && exit
mv replay-spool-folder replay.now
procmail replayrc < replay.now
rm -f replay.now
exit


        ------------ If you have no crontab: --------------

#! /bin/sh
Day=`date '+%a%H'`
case "$Day" in
    Sat*|Sun*|???1[7-9]|???2?|???0[0-6])
        if [ -e replay-spool-folder.lock ]; then
            sleep 20
            exec $0
        fi
        mv replay-spool-folder replay.now
        procmail replayrc < replay.now
        rm replay.now
        # Note: their is no ";;" here!!!
    *)
                sleep 3300
                exec $0
        ;;
esac



Enjoy,
 Udi

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail