Re: About resource of popen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Somebody? help me!!

:D

2007/4/30, Fernando chucre <fernandochucre@xxxxxxxxx>:

Hello all,

I make a script for read and interprete the stdout of cmd `ip monitor`.
And I use signal_handler, the script is like this:
<?
declare(ticks = 1);
pcntl_signal(SIGHUP,"sig_handler",false);


$fh = popen('ip monitor','r');

while (!feof($fh))
{
    $line = fgets($fh);
    analize($line);
}

function analize($line) {  ...  } ;
function sig_handler($signo) { ... };
?>

this script run in infine loop, or when to cmd 'ip monitor' exist. The
script ever whait the next line of 'ip monitor', ever. Then when I send the
signal SIGHUP to pid of script. In this point the instruction '$line =
fgets($fh);' is aborted and return false to $line. The $fh is modified and
the function feof($fh) return true and I have not access to $fh agaim. But
the kid process 'ip monitor' is not kill.

This is wanted?

--
Fernando Chure
PSL/CE




--
Fernando Chure
PSL/CE

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux