losing STDIN
- From: Karstens Rage <karstens@xxxxxxxx>
- Date: Wed, 13 Sep 2006 09:37:56 -0700
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
.
- Follow-Ups:
- Re: losing STDIN
- From: Alvaro G. Vicario
- Re: losing STDIN
- Prev by Date: Re: File Download NOT open
- Next by Date: Run CGI in php
- Previous by thread: File Download NOT open
- Next by thread: Re: losing STDIN
- Index(es):
Relevant Pages
|