Evan Cutler
asked on
PHP Script run as cron to call other php scripts
Greetings,
I have a client that requires me to cron 25 php scripts.
instead of calling 25 crons...
can I make one php script to run the other 25, and execute the "Master" PHP from cron?
If so, does anyone have an example?
Thanks.
I have a client that requires me to cron 25 php scripts.
instead of calling 25 crons...
can I make one php script to run the other 25, and execute the "Master" PHP from cron?
If so, does anyone have an example?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
nothing so difficult in that.
If I use system(), will it wait for the remote script to finish prior to executing the next one?
or can I run multiple at once this way?
If I use system(), will it wait for the remote script to finish prior to executing the next one?
or can I run multiple at once this way?
You can call multiple with system
Yes. System will wait till the script exits before control is returned.
Fortunately all of the PHP functions are documented on the web site. Example:
http://php.net/manual/en/function.system.php
http://php.net/manual/en/function.system.php
ASKER
Thanks much guys.
Most appreciated.
Most appreciated.
You can start asynchronous scripts with a POST-method request. A single CRON script can use cURL to start multiple other scripts. You might want to learn about ignore_user_abort().
Or you can let each script start the next script, in a cascade. The cascade would be useful if there are time-line and/or data dependencies.
Or you can combine the scripts into one larger script. Perhaps you can use include() to load the scripts one after another.