
Starting a new script to run in BG
Date: Sun, 09 Aug 1998 17:35:58 -0600
Quote:
> I am running AS Perl on WinNT 4.0. I am hoping there is solution
> to my dilemma. I would like to have a webpage (Perl Script) load and
> when it does, spawn another process (Perl script, or subroutine) that
> runs in the background until it finishes. Basically, the first time
> each day that a certain script on my site is called up, I want it to run
> a maintenance script. I don't want this to run and have the user wait,
> however, as it could take a while.
I think you shouldn't "spawn" anything. Just display the page (script
does this, doesn't it?) and let the script continue and do their "daily"
job. Don't forget to apply some "locking/loging" logic to prevent more
then one running script(s) to try to do the same job in the same time or
more than once a day.
CGI script just produce an HTML output and continues.
Personaly, I make my clean-up job(s) every time the script is called. For
example, the expired shopping-carts are deleted (if any) at every script
call. I even don't bother if another script instance is making clean-up
at the same time. Let it be! However, this is a true clean-up - i.e. just
deleting. If something is to be logged, modified, etc. the logic would be
much more complicated.
--
=== PLEASE REMOVE ## FROM MY EMAIL ADDRESS! GUESS WHY :-) ===
Plamen Petkov
http://bgbook.hypermart.net