On Tue, 7 Jul 1998, Patrick Olson wrote: > when I try tail -f /var/log/messages | grep "local IP" > > it prints (with a real IP address instead of 123.123.123.123) > > Jul 7 20:06:00 server2 pppd[587]: local IP address 123.123.123.123 > > 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?
i think you've got the wrong "solution" to the problem....in other words, there are better ways of doing what you want. why not do this in /etc/ppp/ip-up (or /etc/ppp/ip-up.d if you are running hamm)? add lines like these to /etc/ppp/ip-up: DYNFILE=/tmp/dynamic.IP # first, delete the file just in case some evil user has it symlinked to # a system file (like /etc/passwd or /bin/bash): rm -f $DYNFILE echo "$4" >$DYNFILE chmod a+r $DYNFILE if this is for a dialin user (and not for a local console user who you've given ppp dialout access to) then you probably need to find out what their home directory is and put the dynamic.IP file in there. try something like this instead: USER=`w | grep "$1" | awk '{print $1}' DYNFILE=/home/$USER/dynamic.IP rm -f $DYNFILE echo "$4" >$DYNFILE chown $USER $DYNFILE chmod a+r $DYNFILE (note: these sh script fragments are untested. use as a guideline only. don't expect them to work as is. RTFM and understand what it does before you trust any random code posted by a complete stranger on a mailing list) the /etc/ppp/ip-up script is passed the following parameters from pppd when the connection is established. that is where the "$1" and "$4" above come from. # This script is called with the following arguments: # Arg Name Example # $1 Interface name ppp0 # $2 The tty ttyS1 # $3 The link speed 38400 # $4 Local IP number 12.34.56.78 # $5 Peer IP number 12.34.56.99 there's also a 6th argument for recent (hamm only, i believe) versions of pppd. i have no idea what it's for. # $6 Optional ``ipparam'' value foo craig -- craig sanders -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null