From owner-freebsd-questions Tue Dec 3 05:37:40 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id FAA13538 for questions-outgoing; Tue, 3 Dec 1996 05:37:40 -0800 (PST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id FAA13530 for ; Tue, 3 Dec 1996 05:37:36 -0800 (PST) Received: from mekong.biomath.jussieu.fr (mekong.biomath.jussieu.fr [134.157.72.87]) by shiva.jussieu.fr (8.8.3/jtpda-5.2) with SMTP id OAA15917 ; Tue, 3 Dec 1996 14:36:08 +0100 (MET) Received: from iaka.biomath.jussieu.fr (iaka) by mekong.biomath.jussieu.fr (5.67b/jn930126+af960928(mailhost)) at Tue, 3 Dec 1996 14:35:49 +0100 Received: by iaka.biomath.jussieu.fr (5.67b/jf930126) at Tue, 3 Dec 1996 14:35:48 +0100 From: af@biomath.jussieu.fr (Alain FAUCONNET) Message-Id: <199612031335.AA07567@iaka.biomath.jussieu.fr> Subject: Re: Shutdown of pppd To: keithl@wakko.gil.net (Keith Leonard) Date: Tue, 3 Dec 1996 14:35:48 +0100 (GMT+0100) Cc: questions@freebsd.org In-Reply-To: from Keith Leonard at "Dec 3, 96 07:28:22 am" X-Mailer: ELM [version 2.4ME+ PL19 (25)] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Keith Leonard wrote / a ecrit: > Howdy, > > I seem to be having a little problem with shutting down my internet > connection. On another UN*X (which will remain unnamed) I use the > following scripts (with small config changes) to start-up and shutdown my > connection to the net (I am using kernel ppp and not tun): > > #!/bin/sh > ps ax | grep pppd | grep -v grep > PID=`ps ax | grep pppd | grep -v grep | awk '{print $1}'` > > if [ "$PID" = "" ] > then > pppd connect 'chat -v "" ATDTXXXXXXX CONNECT ""\ > Name: XXXXXX Password: XXXXXXXXXXX' \ > /dev/cuaa0 38400 : > fi I gather that you seem to be using the kernel version of PPP. Same as the one I use (not on FreeBSD, but that should not be much relevant). So far, so good. > > Not very elegant but it works for getting on - now for getting off: > > #!/bin/sh > pid=`ps ax | grep pppd | grep -v grep | awk '{print$1;}'` > if [ X${pid} != "X" ] ; then > echo 'killing pppd, PID=' ${pid} > kill -9 ${pid} > route flush > fi > > the route flush seems to work (added for FreeBSD) - Now here is the > problem: > > If I try to reconnect within a short time (less than 10 minutes) pppd (I > think) goes through the usual and then informs me that the address already > exist (I assume the ISP assign address - dynamic) and I can get nowhere > (telnet, ftp, etc). What do I need to clean up the mess that this > inelegant soulution has produced so that I can relogin without rebooting > (I'm on a standalone machine). Sending a KILL signal to pppd is NOT a good idea. This signal is not catchable and thus pppd exits abruptly. I hasn't got a chance to do any cleanup, and that might be the cause for your trouble (route flush should not be required if pppd exited cleanly nevertheless). I suggest replacing the "kill -9" by "kill -INT" or "kill -2". The pppd daemon will catch that signal and exit cleanly. _Alain_ -- Alain FAUCONNET Ingenieur systeme - System Manager AP-HP/SIM Public Health 91 bld de l'Hopital 75013 PARIS FRANCE Medical Computing Research Labs Mail: af@biomath.jussieu.fr Tel: (+33) (0)1-40-77-96-19 Fax: (+33) (0)1-45-86-80-68 I've RTFMed. It says: "Refer to your system administrator" But... I *am* the system administrator :-]