Toen wij Justin Gombos kietelden, kwam er dit uit:
Ruud H.G. van Tol:
I've decided to make use of the $$ variable,
but I've decided to use it to name the log file itself. The beginning
of my main script now begins with the following (abridged) code:
PROCESSED_YEAR = `date +"%Y"` #year
PROCESSED_WOY = `date +"%V"` #week of year
That can also be done with 1 date-call and some MATCH-ing.
In stead of WOY you could use the month and the tens of the
daynumber within the month, like (01..09) --> 0, (10..19) --> 1,
(20..31) --> 2. Then you would not need any date-call at all,
because you can derive these from the From_header.
LOGDIR = $HOME/logs/procmail_${PROCESSED_YEAR}-$PROCESSED_WOY/
# Ensure the existance of LOGDIR
:0 c
*$ ! ? test -d $LOGDIR
| mkdir $LOGDIR
LOGFILE = $LOGDIR/$$.log
This is tricky. A recipe with a c-flag runs in parallel, so I guess
it doesn't need to have finished before $LOGDIR is used to set LOGFILE.
I am not really sure that that is a problem, but if it is, I would do
something like:
# Ensure the existance of LOGDIR
:0 # look ma, no c-flag
*$ ! ? test -d "$LOGDIR"
{ DUMMY = `mkdir "$LOGDIR"` }
(untested)
--
Grtz, Ruud
____________________________________________________________
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