[LON-CAPA-cvs] cvs: doc /loncapafiles updatequery.piml
harris41
lon-capa-cvs@mail.lon-capa.org
Sun, 09 Jun 2002 23:31:09 -0000
harris41 Sun Jun 9 19:31:09 2002 EDT
Modified files:
/doc/loncapafiles updatequery.piml
Log:
now makes a mailing to installrecord@mail.lon-capa.org
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.14 doc/loncapafiles/updatequery.piml:1.15
--- doc/loncapafiles/updatequery.piml:1.14 Thu Jun 6 11:44:27 2002
+++ doc/loncapafiles/updatequery.piml Sun Jun 9 19:31:09 2002
@@ -1,7 +1,7 @@
<!-- updatequery.piml -->
<!-- Scott Harrison -->
-<!-- $Id: updatequery.piml,v 1.14 2002/06/06 15:44:27 harris41 Exp $ -->
+<!-- $Id: updatequery.piml,v 1.15 2002/06/09 23:31:09 harris41 Exp $ -->
<!--
@@ -299,7 +299,6 @@
<perlscript mode='fg'>
# read values from loncapa.conf
my $confdir='/etc/httpd/conf/';
-#my $confdir='';
my $filename='loncapa.conf';
my %perlvar;
if (-e "$confdir$filename") {
@@ -454,23 +453,50 @@
print "ENTER 1, 2, 3, or 4:\n";
my $choice=<>;
chomp($choice);
- $line2insert=<<END;
+ $line2insert=<<END;
$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress
END
- $date=`date -I`; chomp($date);
- $lonHostID=$perlvar{'lonHostID'};
- $lonHostID=~s/\W//g;
- $lineexistflag=0;
- $hostidexistflag=0;
+ $date=`date -I`; chomp($date);
+ $lonHostID=$perlvar{'lonHostID'};
+ $lonHostID=~s/\W//g;
+ $lineexistflag=0;
+ $hostidexistflag=0;
if ($choice==1) {
- $lonCluster='production';
+ $lonCluster='production'; $flag=1;
+ }
+ elsif ($choice==2) {
+ $lonCluster='standalone'; $flag=1;
+ open(OUT,'>../'.$lonCluster.'_hosts.tab') or
+ die('file generation error');
+ print(OUT $line2insert);
+ 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) {
`rm -f ../hosts.tab`;
- open(IN,'<../production_hosts.tab');
+ open(IN,'<../'.$lonCluster.'_hosts.tab');
while(<IN>) {
if (/^$line2insert$/) {
$lineexistflag=1;
}
- if (/^$perlvar{'lonHostID'}\:/) {
+ if (/^$lonHostID\:/) {
$hostidexistflag=1;
}
}
@@ -478,65 +504,41 @@
if ($hostidexistflag and !$lineexistflag) {
print <<END;
WARNING: $lonHostID already exists inside
-loncapa/loncom/production_hosts.tab. The entry inside
-production_hosts.tab does not match your settings.
-The entry inside production_hosts.tab is being replaced
+loncapa/loncom/${lonCluster}_hosts.tab. The entry inside
+${lonCluster}_hosts.tab does not match your settings.
+The entry inside ${lonCluster}_hosts.tab is being replaced
with your new values.
END
- `grep -v "$lonHostID:" ../production_hosts.tab > ../new_production_hosts.tab`;
- open(OUT,'>>../new_production_hosts.tab') or
- die("cannot open loncom/standalone_hosts.tab for output\n");
+ `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_production_hosts.tab ../hosts.tab`;
+ `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
# email appropriate message
- `echo "REPLACE:$lonHostID:date:$line2insert" | mail -s "REPLACE:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
+ `echo "REPLACE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "REPLACE:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
}
elsif ($hostidexistflag and $lineexistflag) {
- `ln -s production_hosts.tab ../hosts.tab`;
- }
- elsif (!$$hostidexistflag and !$lineexistflag) {
- `cat ../production_hosts.tab > ../new_production_hosts.tab`;
- `ln -s new_production_hosts.tab > ../hosts.tab`;
+ print <<END;
+Entry exists in ${lonCluster}_hosts.tab.
+END
+ `ln -s ${lonCluster}_hosts.tab ../hosts.tab`;
+ # email appropriate message
+ `echo "STABLEUPDATE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "STABLEUPDATE:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
}
- $flag=1;
- }
- elsif ($choice==2) {
- $lonCluster='standalone';
- open(OUT,'>../standalone_hosts.tab') or
- die("cannot open loncom/standalone_hosts.tab for output\n");
- print(OUT <<END);
-$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress
+ elsif (!$hostidexistflag and !$lineexistflag) {
+ print <<END;
+New entry for $lonCluster.
END
- close(OUT);
- `rm -f ../hosts.tab`;
- `ln -s standalone_hosts.tab ../hosts.tab`;
- $flag=1;
- }
- elsif ($choice==3) {
- $lonCluster='development';
- `rm -f loncom/hosts.tab`;
- `ln -s development_hosts.tab ../hosts.tab`;
- $flag=1;
- }
- elsif ($choice==4) {
- $lonCluster='existing';
- `rm -f ../hosts.tab`;
- `touch existing_hosts.tab`;
- if (-e '/home/httpd/lonTabs/hosts.tab') {
- `cp /home/httpd/lonTabs/hosts.tab ../existing_hosts.tab`;
+ `cat ../${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
+ `echo "INSERT:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "INSERT:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
}
- `ln -s existing_hosts.tab ../hosts.tab`;
- $flag=1;
- }
- elsif ($choice==26) {
- $lonCluster='rawhide';
- `rm -f ../hosts.tab`;
- `ln -s rawhide_hosts.tab ../hosts.tab`;
- $flag=1;
- }
- else {
-
}
}