On Tue, 13 Feb 2001, Pierre Phaneuf wrote:
>
> Is there a way to have a Perl function called at some point in time,
> like I think AOLserver can do in Tcl (but I don't want to do either
> AOLserver or Tcl!)?
>
> I thought about checking the time in a PerlCleanupHandler, but this
> would be in each Apache subprocess and I want this to get called only
> once. The precision is not so important (unless we're talking hours
> later or something like that!).
>
> I thought of having a table of jobs in my PostgreSQL database and
> (carefully avoiding race conditions with transactions/locking) checking
> if the next job was due to be run, but that doesn't "smell" very good. I
> could run the query only on the condition that a minute has passed since
> the last time we did it, but still, I'm not sure.
>
> I would like to know if anyone already did that or have any idea on how
> to do that more properly?
Pretty much what you've already found out - Apache has no "cron" like
daemon. One way you can do it is fork off a sub-process and run some sort
of Cron perl module (I think there's a Cron module on CPAN, or you can run
cron-like features with POE).
--
<Matt/>
/|| ** Director and CTO **
//|| ** AxKit.com Ltd ** ** XML Application Serving **
// || ** http://axkit.org ** ** XSLT, XPathScript, XSP **
// \\| // ** Personal Web Site: http://sergeant.org/ **
\\//
//\\
// \\