[Sussex] Run on net start
Dominic
dominic.clay at btinternet.com
Fri Feb 14 15:07:03 UTC 2003
Thanks...
Now to see what I can make of it in Java :)
----- Original Message -----
From: "John Crowhurst" <fyremoon at fyremoon.net>
To: <sussex at mailman.lug.org.uk>
Sent: Friday, February 14, 2003 1:42 PM
Subject: Re: [Sussex] Run on net start
>
> > Thanks for the pointer John,
> >
> > Looks like a good place for it.
> >
> > The wish list would have a script be something that could actually
> > monitor the interface to see if the route to the 'big wide world' was
> > open...
> >
> > mmmm....now how could I script that.... ????
>
> My router supports SNMP, so I have mrtg watching the traffic going in and
> out on a 10 minute basis.
>
> I wrote a simple ping script as a keepalive/connection re-enabler that
> pings their DNS once a minute to make sure that the line is routable.
>
> Simple stuff is usually the easiest. I wrote mine in perl, but its easy to
> port to a different language, YMMV:
>
> #!/usr/bin/perl
>
> use Net::Ping;
> use Expect;
> $host="their.dns.server";
> $p = Net::Ping->new("icmp");
> if ($p->ping($host)) {
> print "Line is UP\n";
> } else {
> print "Line is DOWN, restart router\n";
> $router="router.ip.address";
> $telnet=Expect->spawn("telnet $router");
> $telnet->expect(30,"ssword: ") || die "Not connected";
> print $telnet "router_password\r";
> print $telnet "ppp 1 disable\r";
> sleep 1;
> print $telnet "ppp 1 enable\r";
> sleep 1;
> print $telnet "@close\r";
> $telnet->hard_close();
> }
>
> The DSL router I have requires a telnet connection to it, and a simple ppp
> 1 disable & ppp 1 enable for it to kick the routing back into gear (hence
> the need for the expect module)
>
> --
> John
>
>
>
> _______________________________________________
> Sussex mailing list
> Sussex at mailman.lug.org.uk
> http://mailman.lug.org.uk/mailman/listinfo/sussex
More information about the Sussex
mailing list