## Time-switching Procmailrc Recipe

From: andrew cooke <andrew@...>

Date: Wed, 7 Mar 2012 21:30:06 -0300

This is really ugly, but it's simple and appears to work.

Take two files - .procmailrc-foo-on and .procmailrc-foo-off - and place in
them the procmail commands you want to switch between.  For example, you might
want to filter work-related emails over the weekend so that they go into a
separate folder; that might be in .procmailrc-foo-off while .procmailrc-foo-on
remains blank.

Next, in crontab, define two commands:

x x x x x rm /home/andrew/.procmailrc-foo; \
ln -s /home/andrew/.procmailrc-foo-on /home/andrew/.procmailrc-foo

x x x x x rm /home/andrew/.procmailrc-foo; \
ln -s /home/andrew/.procmailrc-foo-off /home/andrew/.procmailrc-foo

(those are each single line commands, wrapped for this blog).  One turns the
filter "on" and the other "off" by updating the link.

INCLUDERC=.procmailrc-foo

And the message filtering will swap as required.  There's an unfortunate "gap"
when the switching occurs, but at least in my case I time that to not

Andrew

### Small Corrections

From: andrew cooke <andrew@...>

Date: Wed, 7 Mar 2012 21:54:35 -0300

1 - You need the absolute path in the INCLUDERC (at least, that makes life
simpler)

2 - If INCLUDERC can't find the file, procmail continues just fine, so if one
of the two files you are switching between is empty, you could just delete
Andrew