Re: Launching multiple PHP threads via Scheduled Tasks
| From: | Nick Stinemates | Date: | Tue, 28 Oct 2008 02:30:14 +0000 |
| Subject: | Re: Launching multiple PHP threads via Scheduled Tasks | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282519@lists.php.net to get a copy of this message | ||
On Mon, Oct 27, 2008 at 11:44:50AM -0700, Brian Dunning wrote:
> I've got a script that downloads files queued from a server, and it's
> launched by a Windows Scheduled Task that launches every minute. My
> understanding of the default behavior is that if the task is still
> running a minute later when it's time to launch again, a duplicate
> thread will not be launched.
>
> The remote server administrator wants me to launch multiple threads all
> day - in my mind the wrong choice, since multiple download threads slow
> everyone one, but that's what he wants.
>
> Anyone know if there's a way to make Windows Scheduled Task launch a new
> thread of the PHP script, regardless of whether it's already running?
>
Your assumption is semi-correct, mostly because of your choice of language. If you would have asked
about launvhing another download process, then you would be wrong.
A new _process_ *is* spawned by the Windows Scheduled Task launcher.
Here's a proof.
test.bat
start c:\php\php.exe test.php
start c:\php\php.exe test.php
test.php:
<?php
sleep(20)
print "slept 20 seconds";
?>
Double click on test.bat, you should see 'slept 20 seconds' printed
twice.