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

Reply via email to