losing STDIN



I am using:

PHP 5.0.4 (cli) (built: Feb 24 2006 16:34:55)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies

I wrote a script which basically sits in a while loop doing:

while (!feof(STDIN)) {
$line = fgets(STDIN);
// do something with $line
}

I pipe a tail command into this script like:

tail -n0 -F /var/log/mystuff.log | php -c /etc/php.ini myscript.php &

Everything works fine until logrotate rotates mystuff.log. Then the script just hangs there and no longer processes anything. It doesn't seem to drop out of the while loop but I have to put some more debugging statements in to see if I can figure out what is going on. Any ideas. I don't really get how to deal with feof when the file is rotated.

k
.



Relevant Pages

  • filetype() and exec() issues
    ... anyone else noticing filetypefailing on ISO image files? ... I have a script that during processing will eventually call ... I've reproduced this with both exec, shell_exec, system and the ... Zend Engine v2.2.0, ...
    (php.general)
  • Re: Php random text code to work in version 5
    ... the script does not work on my local machine running php5 but does work ... Copyright 1997-2006 The PHP Group ... Zend Engine v2.1.0, ... No trouble at all with the unmodified small script, just your local php that must be broken somehow. ...
    (alt.php)
  • Re: Report in FM 6 or 7
    ... achieve this report format will have to be done via scripting. ... but they will simplify the script and Sort Order. ... End Loop ... The normal 'Dancer' field is used so that if there are more than one ...
    (comp.databases.filemaker)
  • Re: recreate database script not work
    ... I got a script which is supposed to regenerate database systax. ... REM gen_dbse_9.sql ... end loop; ...
    (comp.databases.oracle.server)
  • Re: Loop Problem (At Least I think)
    ... If there are no images matching the product ... "" Then" statement (the one below the loop, outside of it), is this just ... >> script to finish. ... > 2) Read the database table and acess the dictionary object for the ...
    (microsoft.public.scripting.vbscript)