version 1.26, 2002/02/19 21:12:22
|
version 1.28, 2002/02/19 22:51:13
|
Line 80 $childmaxattempts=5;
|
Line 80 $childmaxattempts=5;
|
|
|
sub online { |
sub online { |
my $host=shift; |
my $host=shift; |
my $p=Net::Ping->new("tcp",10); |
my $p=Net::Ping->new("tcp",20); |
my $online=$p->ping("$host"); |
my $online=$p->ping("$host"); |
$p->close(); |
$p->close(); |
undef ($p); |
undef ($p); |
Line 160 open (CONFIG,"$perlvar{'lonTabDir'}/host
|
Line 160 open (CONFIG,"$perlvar{'lonTabDir'}/host
|
while ($configline=<CONFIG>) { |
while ($configline=<CONFIG>) { |
my ($id,$domain,$role,$name,$ip)=split(/:/,$configline); |
my ($id,$domain,$role,$name,$ip)=split(/:/,$configline); |
chomp($ip); |
chomp($ip); |
$hostip{$id}=$ip; |
if ($ip) { |
|
$hostip{$id}=$ip; |
|
$hostname{$id}=$name; |
|
} |
} |
} |
|
|
close(CONFIG); |
close(CONFIG); |
|
|
# -------------------------------------------------------- Routines for forking |
# -------------------------------------------------------- Routines for forking |
Line 185 sub REAPER { # ta
|
Line 189 sub REAPER { # ta
|
unlink($port); |
unlink($port); |
} |
} |
|
|
sub HUNTSMAN { # signal handler for SIGINT |
sub hangup { |
local($SIG{CHLD}) = 'IGNORE'; # we're going to kill our children |
|
foreach (keys %children) { |
foreach (keys %children) { |
$wasserver=$children{$_}; |
$wasserver=$children{$_}; |
&status("Closing $wasserver"); |
&status("Closing $wasserver"); |
Line 194 sub HUNTSMAN { # si
|
Line 197 sub HUNTSMAN { # si
|
&status("Kill PID $_ for $wasserver"); |
&status("Kill PID $_ for $wasserver"); |
kill ('INT',$_); |
kill ('INT',$_); |
} |
} |
|
} |
|
|
|
sub HUNTSMAN { # signal handler for SIGINT |
|
local($SIG{CHLD}) = 'IGNORE'; # we're going to kill our children |
|
&hangup(); |
my $execdir=$perlvar{'lonDaemons'}; |
my $execdir=$perlvar{'lonDaemons'}; |
unlink("$execdir/logs/lonc.pid"); |
unlink("$execdir/logs/lonc.pid"); |
&logthis("<font color=red>CRITICAL: Shutting down</font>"); |
&logthis("<font color=red>CRITICAL: Shutting down</font>"); |
Line 202 sub HUNTSMAN { # si
|
Line 210 sub HUNTSMAN { # si
|
|
|
sub HUPSMAN { # signal handler for SIGHUP |
sub HUPSMAN { # signal handler for SIGHUP |
local($SIG{CHLD}) = 'IGNORE'; # we're going to kill our children |
local($SIG{CHLD}) = 'IGNORE'; # we're going to kill our children |
foreach (keys %children) { |
&hangup(); |
$wasserver=$children{$_}; |
|
&status("Closing $wasserver"); |
|
&logthis('Closing '.$wasserver.': '.&subreply('exit',$wasserver)); |
|
&status("Kill PID $_ for $wasserver"); |
|
kill ('INT',$_); |
|
} |
|
&logthis("<font color=red>CRITICAL: Restarting</font>"); |
&logthis("<font color=red>CRITICAL: Restarting</font>"); |
unlink("$execdir/logs/lonc.pid"); |
unlink("$execdir/logs/lonc.pid"); |
my $execdir=$perlvar{'lonDaemons'}; |
my $execdir=$perlvar{'lonDaemons'}; |
Line 230 sub checkchildren {
|
Line 232 sub checkchildren {
|
|
|
sub USRMAN { |
sub USRMAN { |
&logthis("USR1: Trying to establish connections again"); |
&logthis("USR1: Trying to establish connections again"); |
foreach $thisserver (keys %hostip) { |
|
$answer=subreply("ping",$thisserver); |
|
&logthis("USR1: Ping $thisserver " |
|
."(pid >$childpid{$thisserver}<, $childatt{thisserver} attempts): " |
|
." >$answer<"); |
|
} |
|
%childatt=(); |
%childatt=(); |
&checkchildren(); |
&checkchildren(); |
} |
} |