version 1.126, 2003/05/06 21:36:42
|
version 1.133, 2003/08/11 21:15:26
|
Line 276 sub checkchildren {
|
Line 276 sub checkchildren {
|
alarm(300); |
alarm(300); |
&logthis('Child '.$_.' did not respond'); |
&logthis('Child '.$_.' did not respond'); |
kill 9 => $_; |
kill 9 => $_; |
$emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; |
#$emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; |
$subj="LON: $currenthostid killed lond process $_"; |
#$subj="LON: $currenthostid killed lond process $_"; |
my $result=`echo 'Killed lond process $_.' | mailto $emailto -s '$subj' > /dev/null`; |
#my $result=`echo 'Killed lond process $_.' | mailto $emailto -s '$subj' > /dev/null`; |
$execdir=$perlvar{'lonDaemons'}; |
#$execdir=$perlvar{'lonDaemons'}; |
$result=`/bin/cp $execdir/logs/lond.log $execdir/logs/lond.log.$_`; |
#$result=`/bin/cp $execdir/logs/lond.log $execdir/logs/lond.log.$_`; |
alarm(0); |
alarm(0); |
} |
} |
} |
} |
Line 665 sub make_new_child {
|
Line 665 sub make_new_child {
|
$loadavg=<$loadfile>; |
$loadavg=<$loadfile>; |
} |
} |
$loadavg =~ s/\s.*//g; |
$loadavg =~ s/\s.*//g; |
my $loadpercent=100*$loadavg/$perlvar{'lonLoadLim'}; |
my $loadpercent=100*$loadavg/$perlvar{'lonLoadLim'}; |
print $client "$loadpercent\n"; |
print $client "$loadpercent\n"; |
|
# -------------------------------------------------------------------- userload |
|
} elsif ($userinput =~ /^userload/) { |
|
my $userloadpercent=&userload(); |
|
print $client "$userloadpercent\n"; |
# ----------------------------------------------------------------- currentauth |
# ----------------------------------------------------------------- currentauth |
} elsif ($userinput =~ /^currentauth/) { |
} elsif ($userinput =~ /^currentauth/) { |
if ($wasenc==1) { |
if ($wasenc==1) { |
Line 822 sub make_new_child {
|
Line 826 sub make_new_child {
|
if ($pwdcorrect) { |
if ($pwdcorrect) { |
my $execdir=$perlvar{'lonDaemons'}; |
my $execdir=$perlvar{'lonDaemons'}; |
&Debug("Opening lcpasswd pipeline"); |
&Debug("Opening lcpasswd pipeline"); |
my $pf = IO::File->new("|$execdir/lcpasswd > /home/www/lcpasswd.log"); |
my $pf = IO::File->new("|$execdir/lcpasswd > $perlvar{'lonDaemons'}/logs/lcpasswd.log"); |
print $pf "$uname\n$npass\n$npass\n"; |
print $pf "$uname\n$npass\n$npass\n"; |
close $pf; |
close $pf; |
my $err = $?; |
my $err = $?; |
Line 1552 sub make_new_child {
|
Line 1556 sub make_new_child {
|
while (($key,$value) = each(%hash)) { |
while (($key,$value) = each(%hash)) { |
my ($descr,$lasttime)=split(/\:/,$value); |
my ($descr,$lasttime)=split(/\:/,$value); |
if ($lasttime<$since) { next; } |
if ($lasttime<$since) { next; } |
if ($regexp eq '.') { |
if ($description eq '.') { |
$qresult.=$key.'='.$descr.'&'; |
$qresult.=$key.'='.$descr.'&'; |
} else { |
} else { |
my $unescapeVal = &unescape($descr); |
my $unescapeVal = &unescape($descr); |
Line 2022 sub make_passwd_file {
|
Line 2026 sub make_passwd_file {
|
{ |
{ |
&Debug("Executing external: ".$execpath); |
&Debug("Executing external: ".$execpath); |
&Debug("user = ".$uname.", Password =". $npass); |
&Debug("user = ".$uname.", Password =". $npass); |
my $se = IO::File->new("|$execpath > /home/www/lcuseradd.log"); |
my $se = IO::File->new("|$execpath > $perlvar{'lonDaemons'}/logs/lcuseradd.log"); |
print $se "$uname\n"; |
print $se "$uname\n"; |
print $se "$npass\n"; |
print $se "$npass\n"; |
print $se "$npass\n"; |
print $se "$npass\n"; |
Line 2067 sub version {
|
Line 2071 sub version {
|
return "version:$VERSION"; |
return "version:$VERSION"; |
} |
} |
|
|
|
#There is a copy of this in lonnet.pm |
|
sub userload { |
|
my $numusers=0; |
|
{ |
|
opendir(LONIDS,$perlvar{'lonIDsDir'}); |
|
my $filename; |
|
my $curtime=time; |
|
while ($filename=readdir(LONIDS)) { |
|
if ($filename eq '.' || $filename eq '..') {next;} |
|
my ($atime)=(stat($perlvar{'lonIDsDir'}.'/'.$filename))[8]; |
|
if ($curtime-$atime < 3600) { $numusers++; } |
|
} |
|
closedir(LONIDS); |
|
} |
|
my $userloadpercent=0; |
|
my $maxuserload=$perlvar{'lonUserLoadLim'}; |
|
if ($maxuserload) { |
|
$userloadpercent=100*$numusers/$maxuserload; |
|
} |
|
$userloadpercent=sprintf("%.2f",$userloadpercent); |
|
return $userloadpercent; |
|
} |
|
|
# ----------------------------------- POD (plain old documentation, CPAN style) |
# ----------------------------------- POD (plain old documentation, CPAN style) |
|
|
=head1 NAME |
=head1 NAME |