- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
$myPid = getmypid();
$state = shell_exec("ps -o \"%p:%P:%c;\"");
$psPid = false;
$processes = array();
$linesArr = explode(";", $state);
foreach($linesArr as $line)
{
$pProp = explode(":", $line);
$processes[trim($pProp[0])] = $pProp;
if($pProp[1] == $myPid)
{
$psPid = $pProp[0];
}
}
//checking pids of processes
if($psPid !== false)
{
if(key_exists($psPid - 1,$processes) && preg_match("/micq/i",$processes[$psPid - 1][2]))
{
$sessionConfig->addPid($psPid - 1);
}
if(key_exists($psPid - 2,$processes) && preg_match("/tail/i",$processes[$psPid - 2][2]))
{
$sessionConfig->addPid($psPid - 2);
}
}
Вот и этот код, про который я рассказывал в комментарии к #4609