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 220.127.116.11)
> Jul 7 20:06:00 server2 pppd: local IP address 18.104.22.168
> 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.
> 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, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org
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 email@example.com < /dev/null