Thanks for all.I have not tried any CPAN module,since we have nearly 300 hosts running this script,and for installing the CPAN module,I have to su to root,but I have no that privileges. As a tmp resolving way,I add a cron to my crontab,and restart this script at everyday's 00:01,since the symlink get changed at 00:00.
-----Original Message----- >From: "JupiterHost.Net" <[EMAIL PROTECTED]> >Sent: Jan 15, 2006 1:04 AM >To: beginners@perl.org >Subject: Re: the 'tail' problem > > > >Jeff Pang wrote: >> hi,lists, > >Hello, > >> I have a log file which is a symbol link to the real logfile,shown as >> following: >> >> $ll mssvr.log >> lrwxrwxrwx 1 cmail root 40 Jan 14 00:00 mssvr.log -> >> /home/cmail/logs/mssvr.log.2006-01-14 >> >> 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:$!"; >> while(<TAIL>) >> { >> do something... >> } >> >> 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: >> >> lrwxrwxrwx 1 cmail root 40 Jan 14 00:00 mssvr.log -> >> /home/cmail/logs/mssvr.log.2006-01-15 >> >> As you see,it's '2006-01-15' now, not '2006-01-14' as before.So the 'tail -f >> $log' become no use for the new symbol link file,and I can't get any input >> from the new logfile in the script. >> >> How can I adjust this problem?Thanks a lot. > >Have you looked at File::Tail::App? It will simplify your life a lot, if >File::Tail catches that its tailing a link and its targte changes. II >*think* it should be transparent. > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] ><http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- 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>