"kráftéé" <kraftee@b&e-cottee.me.uk> wrote in message
news:(E-Mail Removed)...
> Graham J wrote:
>> Suppose I have a server running 24/7 and I want to reset its
>> internet connection when the connection is detected as having
>> failed. Is there any way to use Telnet to reboot a Vigor router,
>> using a single command line or some scripting method?
>>
>> I can see that:
>> Telnet <router IP>
>> Respond to password prompt with correct password
>> Send command : "sys reboot"
>> ... is the general idea
>>
>> Any ideas gratefully received.
>
> Confused (it's not to diffivcault at the moment).
>
> If the router has lost connection how are you going to telent into it
> remotely?
>
> If you want to do it locally then why telnet in when you can access the
> router drectly vis IP?
We can all be confused sometimes!
The server runs 24/7.
The router may lose its internet connection, which indeed will prevent me
gaining access to the server. But the server can correct this for itself
provided that it can interact with the router.
I could run a script (i.e. a batch file) on the server, which pings eternal
IP addresses at regular intervals. If these pings fail, the script should
reboot the router. Scripts are composed of command lines.
I use Alive from
http://www.softlookup.com/author.asp?id=4222 which pings an
IP address and returns a result code. So the script would look like:
alive <external IP address>
if not errorlevel 1 goto ping-good
echo There was no reply, so reboot the router!
telnet <router> <username> <password> <send command "sys reboot">
goto end

ing-good
echo Reply OK, do nothing more.
:end
exit
The problem with this is that the telnet command doesn't work the way I have
indicated. Dennis Ferguson has suggested
http://expect.nist.gov/ for
a program that allows programs such as telnet to work with a script that
sends commands and looks for specific responses.
--
Graham J