[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Try new pppoe connection when down + DynDNS



Am Samstag, 27. Juli 2002 21:31 schrieb Robert Ian Smit:
> My current network connection using pppoe is pretty stable. However
> I want to be sure I can get access to my machine from somewhere
> else.
>
> Is there a preferred way to check if the ppp0 link is up and working
> and if not try to bring it up.

I'm using this function in a perl script to check if the connection is up:

sub dsl_is_connected {
    my $ret_msg = `sudo pppstats`;  # note the permissions
    chomp ($ret_msg);  # remove \n
    if ($ret_msg eq '') {
        # no DSL connection
        return '';
    } elsif ($ret_msg =~ /IN\s+PACK\s+VJCOMP\s+VJUNC\s+VJERR/) {
        # connected
        return true;
    }
    else {
        # should never occur
        # (or only when there were big changes made to pppstats)
        die "unknown case for \'pppstats\': ${ret_msg}";
    }
}

With that you can easily check the connection with something like

	if (dsl_is_connected) { # do something }

>
> If the link is down I also want the DNS record at DynDNS.org to be
> updated to the current ip when the connection is restored. There are
> various clients apt-gettable. I'd like to know about other people
> experiences and possibly to get an advise on which one to use.

I'm using DHIS - and the authentification possibilties I think even fit to 
paranoids ;)

	apt-get install dhid

gets the deamon for you and you can subscribe under http://www.dhis.org

Regards

Christian


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: