Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 May 1998 12:44:11 -0400 (EDT)
From:      CyberPeasant <djv@bedford.net>
To:        tkim@mcs.net (Anthony Kim)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: PPP Scripting Advice
Message-ID:  <199805221644.MAA20525@lucy.bedford.net>
In-Reply-To: <3565A7BA.13386F29@mcs.net> from Anthony Kim at "May 22, 98 11:28:42 am"

next in thread | previous in thread | raw e-mail | index | archive | help
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.

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?199805221644.MAA20525>