note 37258 added to function.exec

From: Date: Fri, 07 Nov 2003 17:22:01 +0000
Subject: note 37258 added to function.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-60110@lists.php.net to get a copy of this message
I tried forever to figure out how to invoke a background process, _then_ get its PID so that I can later check on it. On Linux (with /bin/sh equalling /bin/bash), the following finally worked: $shell_results= exec("wget -O - \"$myurl\" &>/dev/null & echo \$!", $results,$status); The command I'm invoking is 'wget', and $shell_results will end up with the PID of the background wget process. The $results and $status variables I mostly just used for troubleshooting and getting this line working. I put a backslash in front of the dollar sign to keep PHP from trying to interpret it as a variable. ---- Manual Page -- http://www.php.net/manual/en/function.exec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37258 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37258&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37258&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#60110) next »