Solved

PHP Script run as cron to call other php scripts

Posted on 2013-06-13
8
519 Views
Last Modified: 2013-06-14
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.
0
Comment
Question by:Evan Cutler
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 78

Accepted Solution

by:
arnold earned 250 total points
ID: 39246521
Is there data being passed between/among the scripts.
system "script1"
http://stackoverflow.com/questions/732832/php-exec-vs-system-vs-passthru
0
 
LVL 7

Assisted Solution

by:Robert Saylor
Robert Saylor earned 250 total points
ID: 39246581
Yes use system calls.

system('/path/script.php');
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39246943
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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 9

Author Comment

by:Evan Cutler
ID: 39247325
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
 
LVL 7

Expert Comment

by:Robert Saylor
ID: 39247338
You can call multiple with system
0
 
LVL 78

Expert Comment

by:arnold
ID: 39247420
Yes. System will wait till the script exits before control is returned.
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39248079
Fortunately all of the PHP functions are documented on the web site.  Example:
http://php.net/manual/en/function.system.php
0
 
LVL 9

Author Closing Comment

by:Evan Cutler
ID: 39249017
Thanks much guys.
Most appreciated.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question