version 1.51, 2006/12/10 23:38:35
|
version 1.52, 2007/04/03 22:13:40
|
Line 97 while (!$flag) {
|
Line 97 while (!$flag) {
|
} |
} |
elsif ($choice==4) { |
elsif ($choice==4) { |
$lonCluster='existing'; $flag=1; |
$lonCluster='existing'; $flag=1; |
if (-e '/home/httpd/lonTabs/hosts.tab') { |
foreach my $file ('hosts.tab','dns_hosts.tab', |
`cp /home/httpd/lonTabs/hosts.tab ../existing_hosts.tab`; |
'domain.tab','dns_domain.tab') { |
} |
if (-e '/home/httpd/lonTabs/'.$file) { |
else { |
`cp /home/httpd/lonTabs/$file ../existing_$file`; |
print <<END; |
} |
There is no existing /home/httpd/lonTabs/hosts.tab |
else { |
END |
print <<END; |
die(''); |
There is no existing /home/httpd/lonTabs/$file |
} |
|
if (-e '/home/httpd/lonTabs/domain.tab') { |
|
`cp /home/httpd/lonTabs/domain.tab ../existing_domain.tab`; |
|
} |
|
else { |
|
print <<END; |
|
There is no existing /home/httpd/lonTabs/domain.tab |
|
END |
END |
die(''); |
die(''); |
|
} |
} |
} |
} |
} |
elsif ($choice==26) { |
elsif ($choice==26) { |
Line 939 END
|
Line 933 END
|
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); |
|
print OUT ("^$hostname\n"); |
|
close(OUT); |
|
open(OUT,'>../'.$lonCluster.'_dns_hosts.tab') or |
|
die('file generation error'); |
|
print(OUT $line2insert); |
close(OUT); |
close(OUT); |
open(OUT,'>../'.$lonCluster.'_domain.tab') or |
open(OUT,'>../'.$lonCluster.'_domain.tab') or |
die('file generation error'); |
die('file generation error'); |
print(OUT $domaininsert); |
print(OUT $domaininsert); |
close(OUT); |
close(OUT); |
|
open(OUT,'>../'.$lonCluster.'_dns_domain.tab') or |
|
die('file generation error'); |
|
print(OUT $domaininsert); |
|
close(OUT); |
} |
} |
if ($flag==1) { |
if ($flag==1) { |
`rm -f ../hosts.tab`; |
`rm -f ../hosts.tab`; |
open(IN,'<../'.$lonCluster.'_hosts.tab'); |
`rm -f ../dns_hosts.tab`; |
while(<IN>) { |
`ln -s ${lonCluster}_dns_hosts.tab ../dns_hosts.tab`; |
if (/^$line2insert$/) { |
open(IN,'<../'.$lonCluster.'_dns_hosts.tab'); |
|
while(my $line = <IN>) { |
|
if ($line =~ /^\Q$line2insert\E$/) { |
$lineexistflag=1; |
$lineexistflag=1; |
} |
} |
if (/^$lonHostID\:/) { |
if ($line =~ /^\Q$lonHostID\E\:/) { |
$hostidexistflag=1; |
$hostidexistflag=1; |
} |
} |
} |
} |
Line 960 END
|
Line 965 END
|
if ($hostidexistflag and !$lineexistflag) { |
if ($hostidexistflag and !$lineexistflag) { |
print <<END; |
print <<END; |
WARNING: $lonHostID already exists inside |
WARNING: $lonHostID already exists inside |
loncapa/loncom/${lonCluster}_hosts.tab. The entry inside |
loncapa/loncom/${lonCluster}_dns_hosts.tab. The entry inside |
${lonCluster}_hosts.tab does not match your settings. |
${lonCluster}_dns_hosts.tab does not match your settings. |
The entry inside ${lonCluster}_hosts.tab is being replaced |
An entry inside ${lonCluster}_hosts.tab will be made |
with your new values. |
with your new values. |
END |
END |
`grep -v "$lonHostID:" ../${lonCluster}_hosts.tab > ../new_${lonCluster}_hosts.tab`; |
`grep -v "$lonHostID:" ../${lonCluster}_hosts.tab > ../new_${lonCluster}_hosts.tab`; |
Line 976 END
|
Line 981 END
|
} |
} |
elsif ($hostidexistflag and $lineexistflag) { |
elsif ($hostidexistflag and $lineexistflag) { |
print <<END; |
print <<END; |
Entry exists in ${lonCluster}_hosts.tab. |
Entry exists in ${lonCluster}_dns_hosts.tab. Making duplicate entry in ${lonCluster}_hosts.tab |
END |
END |
`ln -s ${lonCluster}_hosts.tab ../hosts.tab`; |
`grep -v "$lonHostID:" ../${lonCluster}_hosts.tab > ../new_${lonCluster}_hosts.tab`; |
|
open(OUT,'>>../new_'.$lonCluster.'_hosts.tab') or |
|
die("cannot open loncom/${lonCluster}_hosts.tab for output\n"); |
|
print(OUT $line2insert); |
|
close(OUT); |
|
`ln -s new_${lonCluster}_hosts.tab ../hosts.tab`; |
# email appropriate message |
# email appropriate message |
`echo "STABLEUPDATE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "STABLEUPDATE:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`; |
`echo "STABLEUPDATE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "STABLEUPDATE:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`; |
} |
} |
Line 999 END
|
Line 1009 END
|
$lineexistflag=0; |
$lineexistflag=0; |
if ($flag==1) { |
if ($flag==1) { |
`rm -f ../domain.tab`; |
`rm -f ../domain.tab`; |
open(IN,'<../'.$lonCluster.'_domain.tab'); |
`rm -f ../dns_domain.tab`; |
while(<IN>) { |
`ln -s ${lonCluster}_dns_domain.tab ../dns_domain.tab`; |
if (/^$domaininsert$/) { |
open(IN,'<../'.$lonCluster.'_dns_domain.tab'); |
|
while(my $line = <IN>) { |
|
if ($line =~/^\Q$domaininsert\E$/) { |
$lineexistflag=1; |
$lineexistflag=1; |
} |
} |
if (/^$perlvar{'lonDefDomain'}\:/) { |
if ($line =~/^\Q$perlvar{'lonDefDomain'}\E\:/) { |
$domainexistflag=1; |
$domainexistflag=1; |
} |
} |
} |
} |
Line 1012 END
|
Line 1024 END
|
if ($domainexistflag and !$lineexistflag) { |
if ($domainexistflag and !$lineexistflag) { |
print <<END; |
print <<END; |
WARNING: $perlvar{'lonDefDomain'} already exists inside |
WARNING: $perlvar{'lonDefDomain'} already exists inside |
loncapa/loncom/${lonCluster}_domain.tab. The entry inside |
loncapa/loncom/${lonCluster}_dns_domain.tab. The entry inside |
${lonCluster}_domain.tab does not match your settings. |
${lonCluster}_dns_domain.tab does not match your settings. |
The entry inside ${lonCluster}_domain.tab is being replaced |
An entry will be made in inside ${lonCluster}_domain.tab |
with your new values. |
with your new values. |
END |
END |
`grep -v "$perlvar{'lonDefDomain'}:" ../${lonCluster}_domain.tab > ../new_${lonCluster}_domain.tab`; |
`grep -v "$perlvar{'lonDefDomain'}:" ../${lonCluster}_domain.tab > ../new_${lonCluster}_domain.tab`; |
Line 1027 END
|
Line 1039 END
|
`echo "REPLACEdom:$lonCluster:$lonHostID:$date:$domaninsert" | mail -s "REPLACEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`; |
`echo "REPLACEdom:$lonCluster:$lonHostID:$date:$domaninsert" | mail -s "REPLACEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`; |
} |
} |
elsif ($domainexistflag and $lineexistflag) { |
elsif ($domainexistflag and $lineexistflag) { |
|
`grep -v "$perlvar{'lonDefDomain'}:" ../${lonCluster}_domain.tab > ../new_${lonCluster}_domain.tab`; |
|
open(OUT,'>>../new_'.$lonCluster.'_domain.tab') or |
|
die("cannot open loncom/${lonCluster}_domain.tab for output\n"); |
|
print(OUT $domaininsert); |
|
close(OUT); |
print <<END; |
print <<END; |
Entry exists in ${lonCluster}_domain.tab. |
Entry exists in ${lonCluster}_dns_domain.tab. Making duplicate entry in ${lonCluster}_domain.tab |
END |
END |
`ln -s ${lonCluster}_domain.tab ../domain.tab`; |
`ln -s new_${lonCluster}_domain.tab ../domain.tab`; |
# email appropriate message |
# email appropriate message |
`echo "STABLEUPDATEdom:$lonCluster:$lonHostID:$date:$domaininsert" | mail -s "STABLEUPDATEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`; |
`echo "STABLEUPDATEdom:$lonCluster:$lonHostID:$date:$domaininsert" | mail -s "STABLEUPDATEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`; |
} |
} |