Solved

PHP Script run as cron to call other php scripts

Posted on 2013-06-13
8
514 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
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 77

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 6

Assisted Solution

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

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

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
 
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 6

Expert Comment

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

Expert Comment

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

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now