note 96007 added to function.getmypid
| From: | gabe at fijiwebdesign dot com | Date: | Tue, 02 Feb 2010 17:53:24 +0000 |
| Subject: | note 96007 added to function.getmypid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165606@lists.php.net to get a copy of this message | ||
Based on what james at voodoo dot co dot uk said, but modified for CLI scripts (ie: there is no
$_SERVER).
<?php
/**
* Check for a current process by filename
* @param $file[optional] Filename
* @return Boolean
*/
function processExists($file = false) {
$exists = false;
$file = $file ? $file : __FILE__;
// Check if file is in process list
exec("ps -C $file -o pid=", $pids);
if (count($pids) > 1) {
$exists = true;
}
return $exists;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 209.155.82.138
----
Manual Page -- http://www.php.net/manual/en/function.getmypid.php
Edit -- https://master.php.net/note/edit/96007
Del: integrated -- https://master.php.net/note/delete/96007/integrated
Del: useless -- https://master.php.net/note/delete/96007/useless
Del: bad code -- https://master.php.net/note/delete/96007/bad+code
Del: spam -- https://master.php.net/note/delete/96007/spam
Del: non-english -- https://master.php.net/note/delete/96007/non-english
Del: in docs -- https://master.php.net/note/delete/96007/in+docs
Del: other reasons-- https://master.php.net/note/delete/96007
Reject -- https://master.php.net/note/reject/96007
Search -- https://master.php.net/manage/user-notes.php