Cannot use exec() to run separate thread ? exec_nowait() anyone?
| From: | Andrej Falout | Date: | Thu, 15 Jun 2000 05:51:07 +0000 |
| Subject: | Cannot use exec() to run separate thread ? exec_nowait() anyone? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-21388@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
- ------------------------ short -------------------
No & in exec() or system()
So PHP always wait for command to complete and exit. Is there
something I missed?
- ----------------------- example -------------------
$exec="sleep 240 &"; #4 minutes
echo strftime("%H:%M:%S\n")."<BR>";
echo "Running $exec <BR>"; flush();
$string = exec($exec,$retvar, $return_status);
echo strftime("%H:%M:%S\n")."<BR>";
echo "Returned-die <BR>"; flush();
Will output:
18:44:25
Running /usr/bin/sudo sleep 240 &
18:48:25
Returned-die
- ---------------------- long ---------------------
I have a problem with running a specific command that initializes
Informix database server. Apparently because of the fact that this
command starts separate threads, and that some of them keep running
even after the original command exits, PHP is unable to detect that
command exited, and just waits indefinitely.
Why is that anyway? If I exec() a shell script, and the script
terminates, that should be enough for PHP to resume control after
exec()?
Additional question would then be how to tell PHP that exec()
completed, from shell script, even if some spawned threads are still
running?
In the lack of this answers, I am asking for the way to run with "&"
but this does not work too, as described.
Do we need something like exec_nowait() command?
Thanks,
Yours, Andrej Falout, http://www.falout.com ICQ 7628616
#-----------------------------------------------------------------
globals "std_disclaimer.4gl"
"Venus is still under construction. Thank you for your patience
and we apologize for the inconvenience." - Match.com online dating
site.
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.0.2i
iQA/AwUBOUfE9BZH34ibpTRkEQI4kwCgtTVJPho/7SltqcksrxZoinDMFScAn0y7
7vPDtU5WyC1XPxQ+UFsk46+G
=8TH0
-----END PGP SIGNATURE-----