[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: tail and grep



On Wed, Jul 08, 1998 at 01:09:27PM -0700, Patrick Olson wrote:
> > > tail -f /var/log/messages | grep "local  IP" > /home/pppusers/dynamic.IP
> > > 
> > > it does nothing but create a 0 byte file.
> > 
> > "tail -f" will run forever; output to the file won't be flushed until you've
> > written a certain amount to the file -- one line obviously isn't enough.
> > The screen on the other hand is flushed immediately. I suspect you don't
> > really need the -f for tail, especially if you are just running this
> > from the ip-up script or something.
> 
> If I ran tail from the script without the -f, it would terminate
> immediately.  Since tail would terminate before the chat part of the
> script has even finished, it would never see the string I'm looking for.
> 
> Am I making any sense here?

I think you need to somehow ensure that tail isn't used until
that line isn't written in the log; -f will get it to wait, but will
never get you any output in the dynamic.IP file.


Hamish
-- 
Hamish Moffatt, hamish@debian.org, hamish@rising.com.au, hmoffatt@mail.com
Latest Debian packages at ftp://ftp.rising.com.au/pub/hamish. PGP#EFA6B9D5
CCs of replies from mailing lists are welcome.   http://hamish.home.ml.org


--  
Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null


Reply to: