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.
LVL 9
Evan CutlerVolunteer Chief Information OfficerAsked:
Who is Participating?
 
arnoldConnect With a Mentor Commented:
Is there data being passed between/among the scripts.
system "script1"
http://stackoverflow.com/questions/732832/php-exec-vs-system-vs-passthru
0
 
Robert SaylorConnect With a Mentor Senior DeveloperCommented:
Yes use system calls.

system('/path/script.php');
0
 
Ray PaseurCommented:
If you can tell us a little more about the scripts and the data we might be able to offer better advice.

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.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Evan CutlerVolunteer Chief Information OfficerAuthor Commented:
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?
0
 
Robert SaylorSenior DeveloperCommented:
You can call multiple with system
0
 
arnoldCommented:
Yes. System will wait till the script exits before control is returned.
0
 
Ray PaseurCommented:
Fortunately all of the PHP functions are documented on the web site.  Example:
http://php.net/manual/en/function.system.php
0
 
Evan CutlerVolunteer Chief Information OfficerAuthor Commented:
Thanks much guys.
Most appreciated.
0
All Courses

From novice to tech pro — start learning today.