View Full Version : PHP script kicking off another PHP script
03-06-2006, 10:58 AM
I have a PHP script that will be kicked off with a cron job. When the script is finishing I want it to start another script. What is the command to do that?
03-06-2006, 02:57 PM
Anything wrong with:
<? php include "file2.php" ?>
If you don't always want to start file2 after file 1 everytime then create a new.php and use it in your Cron:
03-07-2006, 08:44 PM
The problem with including the second script is that you are running within the same process as the first script, and subject to CPU limits etc. It sounds as though your goal is to fork another instance of the process. You can't do this with Cron firing both scripts because they would run in parallel.
There are a number of PHP methods to call a shell cmd. You can find them here http://www.php.net/manual/en/language.operators.execution.php. But each of these will pause the calling script until the cmd completes. So firing PHP from the command line for the second script probably won't work.
At the end of the first script, you could execute a shell cmd to setup another cron job and have that one almost immediately fire the second script.
03-20-2009, 08:33 AM
why don't you pass back a parameter from the first include script to the one that is being executed by cron job so that when you see a value in it is clear that first include finished execution and can start executing second include.
03-20-2009, 08:46 AM
This thread is over three years old. The original posters are long gone. Please don't resurrect old threads.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.