version 1.65, 2002/02/05 17:17:49
|
version 1.68.2.1, 2002/02/06 14:18:09
|
Line 163 $children = 0; # cu
|
Line 163 $children = 0; # cu
|
sub REAPER { # takes care of dead children |
sub REAPER { # takes care of dead children |
$SIG{CHLD} = \&REAPER; |
$SIG{CHLD} = \&REAPER; |
my $pid = wait; |
my $pid = wait; |
$children --; |
if (defined($children{$pid})) { |
&logthis("Child $pid died"); |
&logthis("Child $pid died"); |
delete $children{$pid}; |
$children --; |
|
delete $children{$pid}; |
|
} else { |
|
&logthis("Unknown Child $pid died"); |
|
} |
} |
} |
|
|
sub HUNTSMAN { # signal handler for SIGINT |
sub HUNTSMAN { # signal handler for SIGINT |
Line 204 sub checkchildren {
|
Line 208 sub checkchildren {
|
foreach (sort keys %children) { |
foreach (sort keys %children) { |
unless (-e "$docdir/lon-status/londchld/$_.txt") { |
unless (-e "$docdir/lon-status/londchld/$_.txt") { |
&logthis('Child '.$_.' did not respond'); |
&logthis('Child '.$_.' did not respond'); |
kill 9 => $_; |
kill 9 => $_; |
|
$emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; |
|
$subj="LON: $perlvar{'lonHostID'} killed lond process $_"; |
|
my $result=`echo 'Killed lond process $_.' | mailto $emailto -s '$subj' > /dev/null`; |
|
$execdir=$perlvar{'lonDaemons'}; |
|
$result=`/bin/cp $execdir/logs/lond.log $execdir/logs/lond.log.$_` |
} |
} |
} |
} |
} |
} |
Line 525 sub make_new_child {
|
Line 534 sub make_new_child {
|
while (my $userinput=<$client>) { |
while (my $userinput=<$client>) { |
chomp($userinput); |
chomp($userinput); |
&status('Processing '.$hostid{$clientip}.': '.$userinput); |
&status('Processing '.$hostid{$clientip}.': '.$userinput); |
|
&logthis('Processing '.$hostid{$clientip}.': '.$userinput); |
my $wasenc=0; |
my $wasenc=0; |
alarm(120); |
alarm(120); |
# ------------------------------------------------------------ See if encrypted |
# ------------------------------------------------------------ See if encrypted |
Line 541 sub make_new_child {
|
Line 551 sub make_new_child {
|
$userinput=substr($userinput,0,$cmdlength); |
$userinput=substr($userinput,0,$cmdlength); |
$wasenc=1; |
$wasenc=1; |
} |
} |
} |
&logthis('Decrypted '.$hostid{$clientip}.': '.$userinput); |
|
} |
|
|
# ------------------------------------------------------------- Normal commands |
# ------------------------------------------------------------- Normal commands |
# ------------------------------------------------------------------------ ping |
# ------------------------------------------------------------------------ ping |
if ($userinput =~ /^ping/) { |
if ($userinput =~ /^ping/) { |
Line 1365 sub make_new_child {
|
Line 1377 sub make_new_child {
|
# -------------------------------------------------------------------- complete |
# -------------------------------------------------------------------- complete |
alarm(0); |
alarm(0); |
&status('Listening to '.$hostid{$clientip}); |
&status('Listening to '.$hostid{$clientip}); |
|
&logthis('Completed '.$userinput.' Listening to '.$hostid{$clientip}); |
} |
} |
# --------------------------------------------- client unknown or fishy, refuse |
# --------------------------------------------- client unknown or fishy, refuse |
} else { |
} else { |