Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 May 1998 17:12:07 -0500
From:      Anthony Kim <tkim@mcs.net>
To:        djv@bedford.net
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: PPP Scripting Advice
Message-ID:  <3565F837.1D2EBE9D@mcs.net>
References:  <199805221644.MAA20525@lucy.bedford.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks Dave,

Yeah ip-up, I should have thought of that...here I am trying
everything I can think of in the command line. Doh.

So I've got the ip address printing to /dev/console
However I can't get something like this to work in ip-up 
(if this is do-able)

TTY=`tty`
IP=$4
echo IP address is $IP > $TTY

Obviously what would be nice is the output on /dev/tty???
instead of /dev/console ... not that this is life threatening

I've tried
echo IP address is $IP > /tmp/pppd.stuff
cat /tmp/pppd.stuff > $TTY

but this doesn't work

I'm not a shell expert so if there's some syntax I don't see
please advise.


Rgds,
Anthony



CyberPeasant wrote:
> 
> Anthony Kim wrote:
> > Hey Folks,
> > Two questions.
> >
> > I use the following dial up script for ppp:
> >
> > #!/bin/sh
> > pppd /dev/cuaa0 115200 connect 'chat -f /etc/ppp/dial.chat' &
> >
> > How would I configure it to echo something like
> > Connection completed. Your IP address is: $$
> 
> I believe pppd will look for a script /etc/ppp/ip-up
> The IP addresses are among the arguments passed to that script.
> (man pppd for the rest).
> 
> >
> >
> > 2nd question:
> > I run the following to kill pppd:
> > #!/bin/sh
> > echo "Killing pppd, please wait."
> > cat /var/run/ppp0.pid | xargs kill
> 
> Well, that's a little bit roundabout.
> 
>         if [ -f /var/run/ppp0/pid ] ; then
>                 kill -SIGNAL  `cat /var/run/ppp0.pid`
>         else
>                 echo PPPd does not seem to be running
>         fi
> 
> might be more "usually worded". Subsitute the signal of your
> choice for "SIGNAL" there. Likely choices are -INT -TERM and -HUP
> (See man pppd for details.)
> 
> >
> >
> > It works fine except I have the feeling that I'm missing
> > something here. It seems too easy. netstat -rn and ifconfig -a
> 
> No, pppd catches these signals and goes through the appropriate
> line negotiations for a clean shutdown.
> 
> > show the kill is complete and everything is flushed. If anyone
> > has a good script, I'd love to hear it.
> >
> 
> At some point, pppd will call /etc/ppp/ip-down, after it's been HUPped
> or whatever.You can get fancy in there, although there really isn't
> much to do in the usual case. Clean up any special routes, maybe.
> Some kind of special purpose modem reset, accounting, whatever.
> 
> Dave
> --
>                                Unix System 7:
>       an improvement on all other Unix releases, previous and subsequent.

-- 
Fingerprint: 	2CDE 798E 4140 332C 72D9  0F57 B786 DA9B CBC3 4592
"The conclusion I have reached is that reading is an operation 
 without object; or that its true object is itself." --Italo Calvino
"First and foremost, I think of myself as a reader." --Borges

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3565F837.1D2EBE9D>