Re: Starting a background process and reporting failure if applicable
| From: | Umberto Salsi | Date: | Tue, 18 Aug 2020 08:57:50 +0000 |
| Subject: | Re: Starting a background process and reporting failure if applicable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327295@lists.php.net to get a copy of this message | ||
janis.elmeris@lv.lv (Jānis Elmeris) wrote:
> I would like to start a PHP script in the background from within another
> PHP script. I would like to monitor all error cases properly.
"nohup" and "proc_open()" do not work as there is no way to properly
detach the launched process from the current process. Instead,
see recipe to start a background process by Colin McKinnon at
http://symcbean.blogspot.it/2010/02/php-and-long-running-processes.html
My implementation based on this idea is the OfflineJob class, where
a background process can be lauched, an univocal ticket is returned,
and its current status can be retrieved; stdin can be set and stdout,
stderr can be retrieved:
http://www.icosaedro.it/phplint/phplint2/doc/stdlib/it/icosaedro/web/OfflineJob.html
Regards,
___
/_|_\ Umberto Salsi
\/_\/ www.icosaedro.it