Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Mar 1998 01:48:27 +0000
From:      Nik Clayton <nik@nothing-going-on.demon.co.uk>
To:        Benjamin Lewis <bhlewis@gte.net>, Peter van Heusden <pvh@leftside.wcape.school.za>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Detecting state of PPP
Message-ID:  <19980306014827.13887@nothing-going-on.org>
In-Reply-To: <199803060014.TAA13234@gte.net>; from Benjamin Lewis on Thu, Mar 05, 1998 at 07:14:00PM -0500
References:  <Pine.BSF.3.95.980305071307.15655F-100000@leftside.wcape.school.za> <199803060014.TAA13234@gte.net>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980306014827.13887>