> > 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!).

Matt Sergeant wrote:

> 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).

Hmm, too bad, that would have been easy to implement in the Apache core
request processing loop (it's build into the core of AOLserver). I'll
look to make sure, but I think this will be possible in Apache 2.0.
Anyway, that doesn't fix my problem for now.

Isn't forking off from Apache rather nasty? I saw something to that
effect somewhere in the eagle book and on some web pages, but I think
there are ways to do that without causing problems.

Perrin Harkins wrote:

> The common way to do it is to just use the real cron facility (assuming you
> are on unix) and have it call a URL on your server using LWP.

I am on a Unix-like system, but I wanted the events to be updated by the
web server itself, so that I could use the Apache::DBI cached connection
to the DBMS (I want to store the events in there).

This seems good, exposing a URL that a cron job would fetch every minute
(or something like that). I don't like much the idea of exposing an URL
like that (could be used to cause a DoS, accessing the DBMS like crazy,
but I guess this is a problem for any database-driven web site), but I
can always restrict the URL to 127.0.0.1...

Vivek Khera wrote:

> Set up a handler and have a cron job "GET" the URL for it.

Yeah, I think that's what I'll do!

> You already have the "GET" program from the lwp package while
> installing mod_perl.

I have the mod_perl RPM that comes with Red Hat, and I can't find the
LWP anywhere. Not that I can't install it or use wget instead...

Thanks everyone!

-- 
Pierre Phaneuf
http://www3.sympatico.ca/pphaneuf/

Reply via email to