On 18 June 1999, David W. Tamkin <dattier(_at_)Mcs(_dot_)Net> wrote:
Zombie Cow asked,
| Is there a handy way to take into account the time of day in
| procmail scripts?
Absolutely. It's easiest if the input to procmail has From_
postmarks. I use this method a lot to make recipes that turn
themselves on and off at preset times and dates (or days of the week).
| I have a friend who would like to get his e-mail (top 200 chars)
| forwarded to his GSM as a text message, and all this is OK and I
| think I can do, but how can I take into account the time of day, as
| he would like this to happen only during 1600-0800 clock and not
| during the business hours.
:0 # c flag if appropriate
* ^^From +[^ ].* (Sat |Sun |0[0-7]:|1[6-9]:|2.:)
* other conditions for paging
! pagernumber(_at_)pagercomp(_dot_)any
It doesn't recognize holidays that fall during the week, but doing so
would complicate it greatly, plus I don't know which holidays ZC's
friend gets off, having never lived in Finland. Era?
If you don't have From_ lines with timestamps, you can extract the
time from the topmost Received: header, or failing all else, you can
run date(1).
... Or you can do it the other way around: save messages to a
folder, and have a cron job forward them to your phone.
As for handling holidays and the like, I strongly recommend David
Skoll's "remind":
ftp://ftp.doe.carleton.ca/pub/Remind-3.0/
Unbelievably useful little gadget this one.
Regards,
Liviu Daia
--
Dr. Liviu Daia e-mail: Liviu(_dot_)Daia(_at_)imar(_dot_)ro
Institute of Mathematics web page: http://www.imar.ro/~daia
of the Romanian Academy PGP key: http://www.imar.ro/~daia/daia.asc