Start one script after another consecutively
Posted: Tue Sep 16, 2008 4:24 am
But not simultaneously...
Currently I have a proxy script which does something like:
My fear is that occassionally myscript2.php *might* start before myscript.php finishes which isn't always bad but it could be a PITA and cause weird bugs.
Ideally when the proxy script runs it would execute the first script and only once it's finished and returned execution back to the proxy would it continue with executing the second script.
Reading the docs on shell and process control it sounds like passthru might do the trick of ensuring the scripts execute in proper order??? Anyone care to confirm? Ideally I find a cross platform solution so no crazy process manipulation please.
Cheers
Currently I have a proxy script which does something like:
Code: Select all
shell_exec('myscript.php');
sleep(10);
shell_exec('myscript2.php')Ideally when the proxy script runs it would execute the first script and only once it's finished and returned execution back to the proxy would it continue with executing the second script.
Reading the docs on shell and process control it sounds like passthru might do the trick of ensuring the scripts execute in proper order??? Anyone care to confirm? Ideally I find a cross platform solution so no crazy process manipulation please.
Cheers