From owner-freebsd-hackers Thu Mar 5 18:01:01 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA29138 for freebsd-hackers-outgoing; Thu, 5 Mar 1998 18:01:01 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from nothing-going-on.demon.co.uk (nothing-going-on.demon.co.uk [193.237.89.66]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA29126 for ; Thu, 5 Mar 1998 18:00:54 -0800 (PST) (envelope-from nik@nothing-going-on.demon.co.uk) Received: (from nik@localhost) by nothing-going-on.demon.co.uk (8.8.8/8.8.8) id BAA13834; Fri, 6 Mar 1998 01:48:27 GMT (envelope-from nik) Message-ID: <19980306014827.13887@nothing-going-on.org> Date: Fri, 6 Mar 1998 01:48:27 +0000 From: Nik Clayton 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.89.1i In-Reply-To: <199803060014.TAA13234@gte.net>; from Benjamin Lewis on Thu, Mar 05, 1998 at 07:14:00PM -0500 Organization: Nik at home, where there's nothing going on Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Mar 05, 1998 at 07:14:00PM -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. If you're running a recent(ish) version you've probably got the pppctl program. Here's my ppp-state file (stored in /usr/local/bin) #!/bin/sh # # Report on the state of the PPP link pppctl -v /var/run/ppp quit | grep ^PPP > /dev/null if [ $? -eq 0 ]; then echo Up else echo Down fi N -- Work: nik@iii.co.uk | FreeBSD + Perl + Apache Rest: nik@nothing-going-on.demon.co.uk | Remind me again why we need Play: nik@freebsd.org | Microsoft? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message