From owner-freebsd-questions Fri May 22 10:24:08 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA00620 for freebsd-questions-outgoing; Fri, 22 May 1998 10:24:08 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from lucy.bedford.net (lucy.bedford.net [206.99.145.54]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA00454 for ; Fri, 22 May 1998 10:23:53 -0700 (PDT) (envelope-from listread@lucy.bedford.net) Received: (from listread@localhost) by lucy.bedford.net (8.8.8/8.8.8) id MAA20525; Fri, 22 May 1998 12:44:11 -0400 (EDT) (envelope-from listread) Message-Id: <199805221644.MAA20525@lucy.bedford.net> Subject: Re: PPP Scripting Advice In-Reply-To: <3565A7BA.13386F29@mcs.net> from Anthony Kim at "May 22, 98 11:28:42 am" To: tkim@mcs.net (Anthony Kim) Date: Fri, 22 May 1998 12:44:11 -0400 (EDT) Cc: freebsd-questions@FreeBSD.ORG Reply-to: djv@bedford.net From: CyberPeasant X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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