4 messages in net.sourceforge.lists.courier-maildropRe: [maildropl] How to use time of da...
FromSent OnAttachments
Doc WalkerMar 3, 2005 10:16 pm 
Jay LeeMar 4, 2005 7:55 am 
Sam VarshavchikMar 4, 2005 3:23 pm 
Doc WalkerMar 20, 2005 8:59 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [maildropl] How to use time of day in .mailfilterActions...
From:Doc Walker (rx-m@wvfans.net)
Date:Mar 20, 2005 8:59:22 am
List:net.sourceforge.lists.courier-maildrop

Jay Lee wrote:

Doc Walker said:

I would like to create a rule that operates between the hours of 8:00 AM and 5:00 PM local time. In man (7) maildropex, there is reference to the function 'time', which appears to return the current date/time in number of seconds since Epoch. What is the function to convert this or extract the hour?

I've been unable to locate anything in man maildropfilter or maildropex. Google searches turn up results referring to various Perl modules that perform this conversion, but is there a simpler way?

HOUR=`date +%H`

will assign the current hour to $HOUR. However, it looks like maildrop sees $HOUR as a string not an integer so something like:

if (($HOUR >=8) && ($HOUR <= 17))

will not work. I've really been spoiled by PHP's automatic variable type conversion. You should be able to do something like this though, bit uglier but it'll work, probably is an easier way I'm just not thinking of:

if (($HOUR eq '08') || ($HOUR eq '09') ||...

SOLVED:

#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' # Set environment variables: CURTIME=`/bin/date +%H%M`

#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' # Check whether within appropriate time window if ( 0800 <= $CURTIME && $CURTIME <= 1700 ) { # do something } else { # do something else }

Rx