Diff for /doc/loncapafiles/updatequery.piml between versions 1.14 and 1.15

version 1.14, 2002/06/06 15:44:27 version 1.15, 2002/06/09 23:31:09
Line 299  END Line 299  END
 <perlscript mode='fg'>  <perlscript mode='fg'>
 # read values from loncapa.conf  # read values from loncapa.conf
 my $confdir='/etc/httpd/conf/';  my $confdir='/etc/httpd/conf/';
 #my $confdir='';  
 my $filename='loncapa.conf';  my $filename='loncapa.conf';
 my %perlvar;  my %perlvar;
     if (-e "$confdir$filename") {      if (-e "$confdir$filename") {
Line 454  while (!$flag) { Line 453  while (!$flag) {
   print "ENTER 1, 2, 3, or 4:\n";    print "ENTER 1, 2, 3, or 4:\n";
   my $choice=&lt;&gt;;    my $choice=&lt;&gt;;
   chomp($choice);    chomp($choice);
     $line2insert=&lt;&lt;END;    $line2insert=&lt;&lt;END;
 $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress  $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress
 END  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) {    if ($choice==1) {
     $lonCluster='production';      $lonCluster='production'; $flag=1;
     }
     elsif ($choice==2) {
       $lonCluster='standalone'; $flag=1;
       open(OUT,'&gt;../'.$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 &lt;&lt;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`;      `rm -f ../hosts.tab`;
     open(IN,'&lt;../production_hosts.tab');      open(IN,'&lt;../'.$lonCluster.'_hosts.tab');
     while(&lt;IN&gt;) {      while(&lt;IN&gt;) {
       if (/^$line2insert$/) {        if (/^$line2insert$/) {
         $lineexistflag=1;          $lineexistflag=1;
       }        }
       if (/^$perlvar{'lonHostID'}\:/) {        if (/^$lonHostID\:/) {
         $hostidexistflag=1;          $hostidexistflag=1;
       }        }
     }      }
Line 478  END Line 504  END
     if ($hostidexistflag and !$lineexistflag) {      if ($hostidexistflag and !$lineexistflag) {
       print &lt;&lt;END;        print &lt;&lt;END;
 WARNING: $lonHostID already exists inside  WARNING: $lonHostID already exists inside
 loncapa/loncom/production_hosts.tab.  The entry inside  loncapa/loncom/${lonCluster}_hosts.tab.  The entry inside
 production_hosts.tab does not match your settings.  ${lonCluster}_hosts.tab does not match your settings.
 The entry inside production_hosts.tab is being replaced  The entry inside ${lonCluster}_hosts.tab is being replaced
 with your new values.  with your new values.
 END  END
       `grep -v "$lonHostID:" ../production_hosts.tab &gt; ../new_production_hosts.tab`;        `grep -v "$lonHostID:" ../${lonCluster}_hosts.tab &gt; ../new_${lonCluster}_hosts.tab`;
        open(OUT,'&gt;&gt;../new_production_hosts.tab') or         open(OUT,'&gt;&gt;../new_'.$lonCluster.'_hosts.tab') or
          die("cannot open loncom/standalone_hosts.tab for output\n");           die("cannot open loncom/${lonCluster}_hosts.tab for output\n");
          print(OUT $line2insert);           print(OUT $line2insert);
        close(OUT);         close(OUT);
       `ln -s new_production_hosts.tab ../hosts.tab`;        `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
       # email appropriate message        # 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) {      elsif ($hostidexistflag and $lineexistflag) {
       `ln -s production_hosts.tab ../hosts.tab`;        print &lt;&lt;END;
     }  Entry exists in ${lonCluster}_hosts.tab.
     elsif (!$$hostidexistflag and !$lineexistflag) {  END
       `cat ../production_hosts.tab &gt; ../new_production_hosts.tab`;        `ln -s ${lonCluster}_hosts.tab ../hosts.tab`;
       `ln -s new_production_hosts.tab &gt; ../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 (!$hostidexistflag and !$lineexistflag) {
   }        print &lt;&lt;END;
   elsif ($choice==2) {  New entry for $lonCluster.
     $lonCluster='standalone';  
     open(OUT,'&gt;../standalone_hosts.tab') or  
       die("cannot open loncom/standalone_hosts.tab for output\n");  
     print(OUT &lt;&lt;END);  
 $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress  
 END  END
     close(OUT);        `cat ../${lonCluster}_hosts.tab &gt; ../new_${lonCluster}_hosts.tab`;
     `rm -f ../hosts.tab`;         open(OUT,'&gt;../new_'.$lonCluster.'_hosts.tab') or
     `ln -s standalone_hosts.tab ../hosts.tab`;           die("cannot open loncom/${lonCluster}_hosts.tab for output\n");
     $flag=1;           print(OUT $line2insert);
   }         close(OUT);
   elsif ($choice==3) {        `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
     $lonCluster='development';        # email appropriate message
     `rm -f loncom/hosts.tab`;        `echo "INSERT:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "INSERT:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
     `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`;  
     }      }
     `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 {  
   
   }    }
 }  }
   

Removed from v.1.14  
changed lines
  Added in v.1.15


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>