version 1.19, 2002/09/08 23:57:51
|
version 1.26, 2003/05/08 22:17:33
|
Line 1
|
Line 1
|
<!-- updatequery.piml --> |
<!-- updatequery.piml --> |
<!-- Scott Harrison --> |
|
|
|
<!-- $Id$ --> |
<!-- $Id$ --> |
|
|
Line 52 sleep(3);
|
Line 51 sleep(3);
|
</perlscript> |
</perlscript> |
</file> |
</file> |
<file> |
<file> |
|
<target dist='default'>loncom/hosts.tab</target> |
|
<perlscript mode='fg'> |
|
unless (-l "<TARGET />") { |
|
print(<<END); |
|
|
|
=============================================================================== |
|
What hosts.tab would you like to have installed? |
|
(hosts.tab is a listing of all other internet machines |
|
that a server system considers to be valid server systems |
|
on the LON-CAPA network) |
|
|
|
1) PRODUCTION - you want to deliver courses today or sometime very soon |
|
on this machine |
|
2) STAND-ALONE - you want this machine to run in 'stand-alone' mode and |
|
not be connected to other LON-CAPA machines for now |
|
3) DEVELOPMENT - you want to play with or explore LON-CAPA |
|
4) PRESERVE the existing hosts.tab (/home/httpd/lonTabs/hosts.tab) |
|
|
|
END |
|
# Option number 26 will install rawhide_hosts.tab, but |
|
# the typical user does not want to be part of an intensive |
|
# machine test cluster. |
|
|
|
# get input |
|
# if valid then process, otherwise loop |
|
$flag=0; |
|
while (!$flag) { |
|
print "ENTER 1, 2, 3, or 4:\n"; |
|
my $choice=<>; |
|
chomp($choice); |
|
if ($choice==1) { |
|
$lonCluster='production'; $flag=1; |
|
} |
|
elsif ($choice==2) { |
|
$lonCluster='standalone'; $flag=1; |
|
} |
|
elsif ($choice==3) { |
|
$lonCluster='development'; $flag=1; |
|
} |
|
elsif ($choice==4) { |
|
$lonCluster='existing'; $flag=1; |
|
if (-e '/home/httpd/lonTabs/hosts.tab') { |
|
`cp /home/httpd/lonTabs/hosts.tab ../existing_hosts.tab`; |
|
} |
|
else { |
|
print <<END; |
|
There is no existing /home/httpd/lonTabs/hosts.tab |
|
END |
|
die(''); |
|
} |
|
} |
|
elsif ($choice==26) { |
|
$lonCluster='rawhide'; $flag=1; |
|
} |
|
} |
|
} |
|
</perlscript> |
|
</file> |
|
<file> |
<target dist='default'>/home/httpd/lonTabs/hosts.tab</target> |
<target dist='default'>/home/httpd/lonTabs/hosts.tab</target> |
<perlscript mode='fg'> |
<perlscript mode='fg'> |
$|=1; |
$|=1; |
|
my $domainDescription; |
unless (-e "<TARGET />") { |
unless (-e "<TARGET />") { |
print(<<END); |
print(<<END); |
WELCOME TO LON-CAPA! |
WELCOME TO LON-CAPA! |
Line 175 END
|
Line 234 END
|
} |
} |
} |
} |
|
|
|
|
|
# get domain description |
|
# accept if valid, if not valid, tell user and repeat |
|
$flag=0; |
|
|
|
while (!$flag) { |
|
print(<<END); |
|
|
|
**** Domain Description **** |
|
String describing the domain, to be shown to users. |
|
[Example, msu is Michigan State University] |
|
ENTER DOMAIN DESCRIPTION: |
|
END |
|
|
|
my $choice=<>; |
|
chomp($choice); |
|
if ($choice!~/:/) { |
|
open(OUT,'>>/tmp/loncapa_updatequery.out'); |
|
print(OUT 'domainDescription'."\t".$choice."\n"); |
|
close(OUT); |
|
$domainDescription=$choice; |
|
$flag=1; |
|
} |
|
else { |
|
print "Invalid input (no ':' allowed).\n"; |
|
} |
|
} |
|
|
my $lonHostID; |
my $lonHostID; |
if ($lonDefDomain) { |
if ($lonDefDomain) { |
$lonHostID=$lonDefDomain.$r.int(1+rand(9)); # should be probably also detect |
$lonHostID=$lonDefDomain.$r.int(1+rand(9)); # should be probably also detect |
Line 276 my %perlvar;
|
Line 363 my %perlvar;
|
unless ($perlvar{'lonLoadLim'} and $perlvar{'lonLoadLim'}!~/\{\[\[\[\[/) { |
unless ($perlvar{'lonLoadLim'} and $perlvar{'lonLoadLim'}!~/\{\[\[\[\[/) { |
$perlvar{'lonLoadLim'}='2.00'; |
$perlvar{'lonLoadLim'}='2.00'; |
} |
} |
|
unless ($perlvar{'lonUserLoadLim'} and $perlvar{'lonUserLoadLim'}!~/\{\[\[\[\[/) { |
|
$perlvar{'lonUserLoadLim'}='0'; |
|
} |
unless ($perlvar{'lonExpire'} and $perlvar{'lonExpire'}!~/\{\[\[\[\[/) { |
unless ($perlvar{'lonExpire'} and $perlvar{'lonExpire'}!~/\{\[\[\[\[/) { |
$perlvar{'lonExpire'}='86400'; |
$perlvar{'lonExpire'}='86400'; |
} |
} |
Line 322 my %perlvar;
|
Line 412 my %perlvar;
|
unless ($perlvar{'lonLoadLim'} and $perlvar{'lonLoadLim'}!~/\{\[\[\[\[/) { |
unless ($perlvar{'lonLoadLim'} and $perlvar{'lonLoadLim'}!~/\{\[\[\[\[/) { |
$perlvar{'lonLoadLim'}='2.00'; |
$perlvar{'lonLoadLim'}='2.00'; |
} |
} |
|
unless ($perlvar{'lonUserLoadLim'} and $perlvar{'lonUserLoadLim'}!~/\{\[\[\[\[/) { |
|
$perlvar{'lonUserLoadLim'}='0'; |
|
} |
unless ($perlvar{'lonExpire'} and $perlvar{'lonExpire'}!~/\{\[\[\[\[/) { |
unless ($perlvar{'lonExpire'} and $perlvar{'lonExpire'}!~/\{\[\[\[\[/) { |
$perlvar{'lonExpire'}='86400'; |
$perlvar{'lonExpire'}='86400'; |
} |
} |
Line 347 my %perlvarstatic;
|
Line 440 my %perlvarstatic;
|
} |
} |
close(CONFIG); |
close(CONFIG); |
} |
} |
|
if (!$domainDescription && $lonCluster ne 'existing') { |
|
open(IN,'<../'.$lonCluster.'_hosts.tab'); |
|
while(<IN>) { |
|
if (/^$perlvar{'lonHostID'}\:/) { |
|
(undef,undef,undef,undef,undef,$domainDescription)=split(/:/,$_); |
|
chomp($domainDescription); |
|
last; |
|
} |
|
} |
|
close(IN); |
|
} |
|
if (!$domainDescription) { |
|
open(IN,'</home/httpd/lonTabs/hosts.tab'); |
|
while(<IN>) { |
|
if (/^$perlvar{'lonHostID'}\:/) { |
|
(undef,undef,undef,undef,undef,$domainDescription)=split(/:/,$_); |
|
chomp($domainDescription); |
|
last; |
|
} |
|
} |
|
close(IN); |
|
} |
|
|
# implement editing logic below, interactively |
# implement editing logic below, interactively |
# update loncapa.conf until 7 is entered |
# update loncapa.conf until 8 is entered |
|
|
$flag=0; |
$flag=0; |
|
|
Line 358 while (!$flag) {
|
Line 474 while (!$flag) {
|
=============================================================================== |
=============================================================================== |
This is now the current configuration of your machine. |
This is now the current configuration of your machine. |
1) Domain Name: $perlvar{'lonDefDomain'} |
1) Domain Name: $perlvar{'lonDefDomain'} |
2) Machine Name: $perlvar{'lonHostID'} |
2) Domain Description: $domainDescription |
3) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'} |
3) Machine Name: $perlvar{'lonHostID'} |
4) Role: $perlvar{'lonRole'} |
4) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'} |
5) Cache Expiration Time: $perlvar{'lonExpire'} |
5) Role: $perlvar{'lonRole'} |
6) Server Load: $perlvar{'lonLoadLim'} |
6) Cache Expiration Time: $perlvar{'lonExpire'} |
7) Everything is correct up above |
7) Server Load: $perlvar{'lonLoadLim'} |
|
8) User Load: $perlvar{'lonUserLoadLim'} |
|
9) Everything is correct up above |
END |
END |
my $hbug=-1; |
my $hbug=-1; |
my $dbug=-1; |
my $dbug=-1; |
Line 390 if ($dbug) {
|
Line 508 if ($dbug) {
|
} |
} |
|
|
print(<<END); |
print(<<END); |
ENTER A CHOICE OF 1-6 TO CHANGE, otherwise ENTER 7: |
ENTER A CHOICE OF 1-8 TO CHANGE, otherwise ENTER 9: |
END |
END |
my $choice=<>; |
my $choice=<>; |
chomp($choice); |
chomp($choice); |
if ($choice==1) { |
if ($choice==1) { |
print(<<END); |
print(<<END); |
1) Domain Name: $perlvar{'lonDefDomain'} |
1) Domain Name: $perlvar{'lonDefDomain'} |
ENTER NEW VALUE: |
ENTER NEW VALUE (this is an internal value used to identify a group of |
|
LON-CAPA machines, it must be alphanumerical, we suggest |
|
using a part of your actual DNS domain. For example, for |
|
the machine loncapa.msu.edu, we set the Domain to msu): |
END |
END |
my $choice2=<>; |
my $choice2=<>; |
chomp($choice2); |
chomp($choice2); |
Line 405 END
|
Line 526 END
|
} |
} |
elsif ($choice==2) { |
elsif ($choice==2) { |
print(<<END); |
print(<<END); |
2) Machine Name: $perlvar{'lonHostID'} |
2) Domain Description: $domainDescription |
ENTER NEW VALUE: |
ENTER NEW VALUE (this should be a string that describes your domain, spaces |
|
and punctuation are fine except for ':'): |
END |
END |
my $choice2=<>; |
my $choice2=<>; |
chomp($choice2); |
chomp($choice2); |
$perlvar{'lonHostID'}=$choice2; |
$domainDescription=$choice2; |
} |
} |
elsif ($choice==3) { |
elsif ($choice==3) { |
print(<<END); |
print(<<END); |
3) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'} |
3) Machine Name: $perlvar{'lonHostID'} |
ENTER NEW VALUE: |
ENTER NEW VALUE (this will be the name of the machine in the LON-CAPA network |
|
it cannot contain any of '_' '-' '.' or ':'. We suggest that |
|
if you are in the domain 'example' and are the first library |
|
server you enter 'examplel1') : |
END |
END |
my $choice2=<>; |
my $choice2=<>; |
chomp($choice2); |
chomp($choice2); |
$perlvar{'lonAdmEMail'}=$choice2; |
$perlvar{'lonHostID'}=$choice2; |
} |
} |
elsif ($choice==4) { |
elsif ($choice==4) { |
print(<<END); |
print(<<END); |
4) Role: $perlvar{'lonRole'} |
4) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'} |
ENTER NEW VALUE: |
ENTER NEW VALUE: |
END |
END |
my $choice2=<>; |
my $choice2=<>; |
chomp($choice2); |
chomp($choice2); |
$perlvar{'lonRole'}=$choice2; |
$perlvar{'lonAdmEMail'}=$choice2; |
} |
} |
elsif ($choice==5) { |
elsif ($choice==5) { |
print(<<END); |
print(<<END); |
5) Cache Expiration Time: $perlvar{'lonExpire'} |
5) Role: $perlvar{'lonRole'} |
ENTER NEW VALUE: |
ENTER NEW VALUE (this should be either 'access' or 'library' |
|
if in doubt select 'library'): |
END |
END |
my $choice2=<>; |
my $choice2=<>; |
chomp($choice2); |
chomp($choice2); |
$perlvar{'lonExpire'}=$choice2; |
$perlvar{'lonRole'}=$choice2; |
} |
} |
elsif ($choice==6) { |
elsif ($choice==6) { |
print(<<END); |
print(<<END); |
6) Server Load: $perlvar{'lonLoadLim'} |
6) Cache Expiration Time: $perlvar{'lonExpire'} |
|
ENTER NEW VALUE (in seconds, 86400 is a reasonable value): |
|
END |
|
my $choice2=<>; |
|
chomp($choice2); |
|
$perlvar{'lonExpire'}=$choice2; |
|
} |
|
elsif ($choice==7) { |
|
print(<<END); |
|
7) Server Load: $perlvar{'lonLoadLim'} |
ENTER NEW VALUE: |
ENTER NEW VALUE: |
END |
END |
my $choice2=<>; |
my $choice2=<>; |
chomp($choice2); |
chomp($choice2); |
$perlvar{'lonLoadLim'}=$choice2; |
$perlvar{'lonLoadLim'}=$choice2; |
} |
} |
elsif ($choice==7) { |
elsif ($choice==8) { |
|
print(<<END); |
|
8) User Load: $perlvar{'lonUserLoadLim'} |
|
Numer of users that can login before machine is 'overloaded' |
|
ENTER NEW VALUE (integer value, 0 means there is no limit): |
|
END |
|
my $choice2=<>; |
|
chomp($choice2); |
|
$perlvar{'lonUserLoadLim'}=$choice2; |
|
} |
|
elsif ($choice==9) { |
$flag=1; |
$flag=1; |
} |
} |
else { |
else { |
Line 470 END
|
Line 615 END
|
<target dist='default'>loncom/hosts.tab</target> |
<target dist='default'>loncom/hosts.tab</target> |
<perlscript mode='fg'> |
<perlscript mode='fg'> |
unless (-l "<TARGET />") { |
unless (-l "<TARGET />") { |
print(<<END); |
my $hostname=`hostname`;chomp($hostname); |
|
my $hostaddress=`hostname -i $hostname`;chomp($hostaddress); |
=============================================================================== |
$hostaddress=~s/\s//; |
What hosts.tab would you like to have installed? |
|
(hosts.tab is a listing of all other internet machines |
|
that a server system considers to be valid server systems |
|
on the LON-CAPA network) |
|
|
|
1) PRODUCTION - you want to deliver courses today or sometime very soon |
|
on this machine |
|
2) STAND-ALONE - you want this machine to run in 'stand-alone' mode and |
|
not be connected to other LON-CAPA machines for now |
|
3) DEVELOPMENT - you want to play with or explore LON-CAPA |
|
4) PRESERVE the existing hosts.tab (/home/httpd/lonTabs/hosts.tab) |
|
|
|
END |
|
# Option number 26 will install rawhide_hosts.tab, but |
|
# the typical user does not want to be part of an intensive |
|
# machine test cluster. |
|
|
|
# get input |
|
# if valid then process, otherwise loop |
|
my $hostname=`hostname`;chomp($hostname); |
|
my $hostaddress=`hostname -i $hostname`;chomp($hostaddress); |
|
$flag=0; |
|
while (!$flag) { |
|
print "ENTER 1, 2, 3, or 4:\n"; |
|
my $choice=<>; |
|
chomp($choice); |
|
$line2insert=<<END; |
|
$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress |
|
END |
|
$date=`date -I`; chomp($date); |
$date=`date -I`; chomp($date); |
$lonHostID=$perlvar{'lonHostID'}; |
$lonHostID=$perlvar{'lonHostID'}; |
$lonHostID=~s/\W//g; |
$lonHostID=~s/\W//g; |
$lineexistflag=0; |
$lineexistflag=0; |
$hostidexistflag=0; |
$hostidexistflag=0; |
if ($choice==1) { |
$line2insert=<<END; |
$lonCluster='production'; $flag=1; |
$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress:$domainDescription |
} |
END |
elsif ($choice==2) { |
if ($lonCluster eq 'standalone') { |
$lonCluster='standalone'; $flag=1; |
|
open(OUT,'>../'.$lonCluster.'_hosts.tab') or |
open(OUT,'>../'.$lonCluster.'_hosts.tab') or |
die('file generation error'); |
die('file generation error'); |
print(OUT $line2insert); |
print(OUT $line2insert); |
close(OUT); |
close(OUT); |
} |
} |
elsif ($choice==3) { |
|
$lonCluster='development'; $flag=1; |
|
} |
|
elsif ($choice==4) { |
|
$lonCluster='existing'; $flag=1; |
|
if (-e '/home/httpd/lonTabs/hosts.tab') { |
|
`cp /home/httpd/lonTabs/hosts.tab ../existing_hosts.tab`; |
|
} |
|
else { |
|
print <<END; |
|
There is no existing /home/httpd/lonTabs/hosts.tab |
|
END |
|
die(''); |
|
} |
|
} |
|
elsif ($choice==26) { |
|
$lonCluster='rawhide'; $flag=1; |
|
} |
|
if ($flag==1) { |
if ($flag==1) { |
`rm -f ../hosts.tab`; |
`rm -f ../hosts.tab`; |
open(IN,'<../'.$lonCluster.'_hosts.tab'); |
open(IN,'<../'.$lonCluster.'_hosts.tab'); |
Line 578 END
|
Line 675 END
|
New entry for $lonCluster. |
New entry for $lonCluster. |
END |
END |
`cat ../${lonCluster}_hosts.tab > ../new_${lonCluster}_hosts.tab`; |
`cat ../${lonCluster}_hosts.tab > ../new_${lonCluster}_hosts.tab`; |
open(OUT,'>../new_'.$lonCluster.'_hosts.tab') or |
open(OUT,'>>../new_'.$lonCluster.'_hosts.tab') or |
die("cannot open loncom/${lonCluster}_hosts.tab for output\n"); |
die("cannot open loncom/new_${lonCluster}_hosts.tab for output\n"); |
print(OUT $line2insert); |
print(OUT $line2insert); |
close(OUT); |
close(OUT); |
`ln -s new_${lonCluster}_hosts.tab ../hosts.tab`; |
`ln -s new_${lonCluster}_hosts.tab ../hosts.tab`; |
Line 588 END
|
Line 685 END
|
} |
} |
} |
} |
} |
} |
|
|
} |
|
</perlscript> |
</perlscript> |
</file> |
</file> |
</files> |
</files> |