Re: Remotely rebooting a crashed server


Subject: Re: Remotely rebooting a crashed server
From: Christopher Murtagh (christopher.murtagh@mcgill.ca)
Date: Fri Oct 26 2001 - 16:06:39 MDT


On Fri, 26 Oct 2001, Sam Moore wrote:
>Anybody know a solution for restarting a crashed server remotely?
>(Actually eth0 goes deaf, but it's effectively the same thing).

 No, it isn't the same thing. I had the same problem with one of my
servers as well. Lemme guess, when you type 'dmesg' you get a whole bunch
of 'eth0: transmit timed out, resetting' messages, right? All I did was
restart the network when it detected that it was no longer connected. To
do this, I have a script that runs as a cronjob every two minutes. I added
the secondary machine because my router would sometimes not respond to the
ping and make it restart the network unnecessarily. Here it is:

#!/usr/bin/perl -w

$Router = '132.216.XXX.XXX';
$Secondary = '132.216.XXX.XXX';

use Net::Ping;

$p = Net::Ping->new('icmp',20,64) or die "Can't create new ping object: $!\n";

if (!($p->ping($Router)))
 {
 
   if (!($p->ping($Secondary)))
     {
       system("/etc/rc.d/init.d/network restart") && warn "Couldn't restart network!\n\n";
       print "Network was restarted!\n\n";
     }
 }

 $p->close;

exit;

 This is much nicer than forcing your machine to power cycle, and works
like a charm.

 Also, if you can telephone into a power supply right next to the machine,
why not telephone directly into the machine itself and do a proper reboot
or network fix (seeing as the machine doesn't crash, it just loses touch
with eth0).

Cheers,

Chris

-- 

Christopher Murtagh Webmaster / Sysadmin Web Communications Group McGill University Montreal, Quebec Canada

Tel.: (514) 398-3122 Fax: (514) 398-2017



This archive was generated by hypermail 2a24 : Fri Oct 26 2001 - 15:17:16 MDT