Thanks for Adriano.I have tried the way that mentioned by you,and  found it's 
no use for me.
should the '-F' option  have no effect for symlinks maybe?

-----Original Message-----
>From: Adriano Ferreira <[EMAIL PROTECTED]>
>Sent: Jan 14, 2006 7:23 PM
>To: Jeff Pang <[EMAIL PROTECTED]>, beginners@perl.org
>Subject: Re: the 'tail' problem
>
>Jeff,
>
>Maybe all you have to do is make some adjustments to the pipe you're
>opening. Besides the well known "-f" switch, some tail's (like gnu
>tail) support "-F" which means a file is followed by its name and the
>opening is retried from time to time. From "man tail" (GNU):
>
>       -F     same as --follow=name --retry
>
>      With  --follow  (-f),  tail  defaults to following the file descriptor,
>      which means that even if a tail'ed file is renamed, tail will  continue
>      to  track  its  end.   This  default behavior is not desirable when you
>      really want to track the actual name of the file, not the file descrip-
>      tor (e.g., log rotation).  Use --follow=name in that case.  That causes
>      tail to track the named file by reopening it periodically to see if  it
>      has been removed and recreated by some other program.
>
>If you found it works for symlinks, all you have to do is use
>
>>     open (TAIL,"tail -F $log|") or die "can't open pipe:$!";
>
>Regards,
>Adriano Ferreira.
>
>On 1/14/06, Jeff Pang <[EMAIL PROTECTED]> wrote:
>> I have a log file which is a symbol link to the real logfile,shown as 
>> following:
>
>> I have to access this file in perl script with unix 'tail -f' command.Part 
>> of the code is below:
>>
>>     open (TAIL,"tail -f $log|") or die "can't open pipe:$!";
>
>> This script is a daemon script which run permanently.There is no problem 
>> when in the same day.But when the date changed,the symbol link file will 
>> point to another real logfile automatically (which decided by other 
>> application program),such as:
>>
>[snip]
>>
>> How can I adjust this problem?Thanks a lot.


--
http://home.earthlink.net/~pangj/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to