RE: Re: How do I get php to repeat and action every day?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I have gotten a good idea about how contrabs work and task 
> schedlar. Enough to know that task schedular does only permit 
> one schedualed task at a time.
> If, say, I had an entire folder of files that just kept 
> growing, it would take allot of manual intervention to get 
> the entire folder to execute with task schedular, however, is 
> there any way to do this in a contrab?

In all honesty, if I had a folder of scripts that I needed to execute at a
given time, I'd probably cheat and make one "control" script that was
responsible for calling all of the other scripts. 

So 

master_script.php

would look vaguely like:

<?php
exec("php script1.php");
exec("php script2.php");
exec("php script3.php");
exec("php script4.php");
?>

That way as needs change you can just make changes to the one
master_script.php instead of having to edit your cron jobs or risk creating
stupidly large amounts of windows scheduled tasks.

Granted that this requires you to have scripts that all will run at the same
time and don't demand different execution times. The other things to keep in
mind is that the initial instance of PHP that runs that master_script.php
will need to be running for the entire length of time that it will take all
of the other files to execute - so be careful of PHP timeouts and modify
your php.ini file if needed/if safe.

The other option, of course, is to get more fancy and read the contents of a
file, build an array and then build a for loop that'd exec() each of the
array elements in turn. This would make the process a lot more hands-off
than the above-mentioned hard-coded master_script.php file (though a bit
longer to impliment and with the same inherent time-out issue as noted above
plus a bit more time for the script itself to execute).

Either way, there's a few options that may spawn some better ideas from
others on the list :)

> Thanks!

Not a problem!

-M

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux