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

Re: tail and grep

On Tue, Jul 07, 1998 at 08:28:37PM -0700, Patrick Olson wrote:
> when I try tail -f /var/log/messages | grep "local  IP"
> it prints (with a real IP address instead of
> Jul  7 20:06:00 server2 pppd[587]: local  IP address
> on my console.  That's exactly what it should do.  But if I try to
> redirect it to a user's file (so he can see what his dynamic IP is) using
> tail -f /var/log/messages | grep "local  IP" > /home/pppusers/dynamic.IP
> it does nothing but create a 0 byte file.
> Questions:
> 1. What am I doing wrong?
> 2. Is there a way I can put this in the background so I don't have to
> remain logged in as root?

"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.

You can run any program in the background by putting an & on the end.

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: