From owner-freebsd-hackers Thu Mar 5 17:21:35 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA23574 for freebsd-hackers-outgoing; Thu, 5 Mar 1998 17:21:35 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from allegro.lemis.com (allegro.lemis.com [192.109.197.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA23564 for ; Thu, 5 Mar 1998 17:21:23 -0800 (PST) (envelope-from grog@lemis.com) Received: from freebie.lemis.com (freebie.lemis.com [192.109.197.137]) by allegro.lemis.com (8.8.7/8.8.5) with ESMTP id LAA13185; Fri, 6 Mar 1998 11:51:12 +1030 (CST) Received: (from grog@localhost) by freebie.lemis.com (8.8.8/8.8.7) id LAA05482; Fri, 6 Mar 1998 11:51:11 +1030 (CST) (envelope-from grog) Message-ID: <19980306115111.62161@freebie.lemis.com> Date: Fri, 6 Mar 1998 11:51:11 +1030 From: Greg Lehey To: Benjamin Lewis , Peter van Heusden Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Detecting state of PPP References: <199803060014.TAA13234@gte.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89i In-Reply-To: <199803060014.TAA13234@gte.net>; from Benjamin Lewis on Thu, Mar 05, 1998 at 07:14:00PM -0500 WWW-Home-Page: http://www.lemis.com/~grog Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 5 March 1998 at 19:14:00 -0500, Benjamin Lewis wrote: > > pvh@leftside.wcape.school.za wrote: > >> How does one go about writing a program to check if a PPP link is up >> or down? > > I've seen lots of complicated responses to this, so there is probably > something inherintly wrong with what I've always done, check for the > existence of the /var/spool/lock/LCK..cuaa? file. If there is a possibility > that something else is using the serial line, one could check whether the > PID in the file matches the PPP process. Why not just look at the interface status: $ ifconfig -a lp0: flags=8810 mtu 1500 ep0: flags=8843 mtu 1500 inet 192.109.197.137 netmask 0xffffff00 broadcast 192.109.197.255 ether 00:a0:24:37:0d:2b tun0: flags=8151 mtu 1518 inet 192.109.197.137 --> 192.109.197.211 netmask 0xffffff00 This one is up (RUNNING) sl0: flags=c010 mtu 552 ppp0: flags=8051 mtu 1500 inet 139.130.136.133 --> 139.130.136.129 netmask 0xffff0000 This one is up ppp1: flags=8010 mtu 1500 This one is down lo0: flags=8049 mtu 16384 inet 127.0.0.1 netmask 0xff000000 Greg To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message