Annotation of doc/loncapafiles/updatequery.piml, revision 1.20
1.2 harris41 1: <!-- updatequery.piml -->
1.1 harris41 2: <!-- Scott Harrison -->
3:
1.20 ! albertel 4: <!-- $Id: updatequery.piml,v 1.19 2002/09/08 23:57:51 harris41 Exp $ -->
1.1 harris41 5:
6: <!--
7:
8: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9:
10: LON-CAPA is free software; you can redistribute it and/or modify
11: it under the terms of the GNU General Public License as published by
12: the Free Software Foundation; either version 2 of the License, or
13: (at your option) any later version.
14:
15: LON-CAPA is distributed in the hope that it will be useful,
16: but WITHOUT ANY WARRANTY; without even the implied warranty of
17: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: GNU General Public License for more details.
19:
20: You should have received a copy of the GNU General Public License
21: along with LON-CAPA; if not, write to the Free Software
22: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23:
24: /home/httpd/html/adm/gpl.txt
25:
26: http://www.lon-capa.org/
27:
28: -->
29:
30: <piml>
31: <targetroot>/</targetroot>
32: <files>
33: <file>
1.4 harris41 34: <target dist='default'>/</target>
1.1 harris41 35: <perlscript mode='fg'>
1.4 harris41 36: $|=1;
1.1 harris41 37: print(<<END);
38:
39:
40: *********************************************
41: *********************************************
42: **** ****
43: **** LON-CAPA SYSTEM INFORMATION REQUEST ****
44: **** ****
45: **** Please respond to the choices below ****
46: **** ****
47: *********************************************
48: *********************************************
49:
50: END
1.4 harris41 51: sleep(3);
1.1 harris41 52: </perlscript>
53: </file>
54: <file>
1.10 harris41 55: <target dist='default'>/home/httpd/lonTabs/hosts.tab</target>
1.1 harris41 56: <perlscript mode='fg'>
1.4 harris41 57: $|=1;
1.20 ! albertel 58: my $domainDescription;
1.1 harris41 59: unless (-e "<TARGET />") {
60: print(<<END);
61: WELCOME TO LON-CAPA!
62:
63: If you have questions, please visit http://install.lon-capa.org
1.5 harris41 64: or contact sharrison\@mail.lon-capa.org.
1.1 harris41 65:
66: ===============================================================================
1.4 harris41 67: The following 4 values are needed to configure LON-CAPA:
68: * Machine Role
1.8 harris41 69: * LON-CAPA Domain Name
70: * LON-CAPA Machine ID Name, and
1.1 harris41 71: * System Administration E-mail Address.
72: END
1.3 harris41 73:
1.4 harris41 74: open(OUT,'>/tmp/loncapa_updatequery.out');
75: close(OUT);
76:
1.3 harris41 77: # query for Machine Role
78: print(<<END);
79: **** Machine Role ****
80: Library server (recommended if first-time installation of LON-CAPA):
81: Servers that are repositories of authoritative educational resources.
82: These servers also provide the construction space by which instructors
83: assemble their classroom online material.
84: Access server:
85: Servers that load-balance high-traffic delivery of educational resources
86: over the world-wide web.
1.4 harris41 87: 1) Will this be a library server? (recommended if this is your first install)
1.3 harris41 88: 2) Or, will this be an access server?
89: END
1.4 harris41 90: my $flag=0;
91: my $r='';
92: my $lonRole;
93: while (!$flag) {
94: print "ENTER A CHOICE OF 1 or 2:\n";
95: my $choice=<>;
96: chomp($choice);
97: if ($choice==1) {
98: open(OUT,'>>/tmp/loncapa_updatequery.out');
99: print(OUT 'lonRole'."\t".'library'."\n");
100: close(OUT);
101: $lonRole='library';
102: $r='l';
103: $flag=1;
104: }
105: elsif ($choice==2) {
106: open(OUT,'>>/tmp/loncapa_updatequery.out');
107: print(OUT 'lonRole'."\t".'access'."\n");
108: close(OUT);
109: $lonRole='access';
110: $r='a';
111: $flag=2;
112: }
113: else {
114:
115: }
116: }
1.3 harris41 117:
118: # need to recommend a machine ID name (ipdomain.l.somenumber)
1.4 harris41 119: my $hostname=`hostname`; chomp($hostname);
120: my $ipdomain='';
121: if ($hostname=~/([^\.]*)\.([^\.]*)$/) {
122: $ipdomain=$1;
123: }
1.1 harris41 124:
125: print(<<END);
126:
1.8 harris41 127: **** Domain ****
128: [this does NOT need to correspond to internet address domains,
129: examples might be "msu" or "bionet" or "vermontcc"]
1.1 harris41 130: END
1.8 harris41 131:
132: # get domain name
1.1 harris41 133: # accept if valid, if not valid, tell user and repeat
1.4 harris41 134: $flag=0;
1.8 harris41 135: my $lonDefDomain;
1.4 harris41 136: while (!$flag) {
137: if ($ipdomain) {
138: print(<<END);
1.8 harris41 139: ENTER LONCAPA DOMAIN [$ipdomain]:
1.4 harris41 140: END
141: }
142: else {
143: print(<<END);
1.8 harris41 144: ENTER LONCAPA DOMAIN:
1.4 harris41 145: END
146: }
147: my $choice=<>;
148: chomp($choice);
1.18 harris41 149: my $bad_domain_flag=0;
150: my @bad_domain_names=('raw','userfiles','priv','adm','uploaded');
151: foreach my $bad (@bad_domain_names) {
152: $bad_domain_flag=1 if $choice eq $bad;
153: }
1.8 harris41 154: if ($ipdomain and $choice=~/^\s*$/) {
155: $choice=$ipdomain;
1.4 harris41 156: open(OUT,'>>/tmp/loncapa_updatequery.out');
1.8 harris41 157: print(OUT 'lonDefDomain'."\t".$choice."\n");
1.4 harris41 158: close(OUT);
1.8 harris41 159: $lonDefDomain=$choice;
1.4 harris41 160: $flag=1;
161: }
162: elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
163: open(OUT,'>>/tmp/loncapa_updatequery.out');
1.8 harris41 164: print(OUT 'lonDefDomain'."\t".$choice."\n");
1.4 harris41 165: close(OUT);
1.8 harris41 166: $lonDefDomain=$choice;
167: $r='l';
1.4 harris41 168: $flag=1;
1.18 harris41 169: }
170: elsif ($bad_domain_flag) {
171: print "Invalid input ('$choice' conflicts with LON-CAPA namespace).\n";
172: print "Please try something different than '$choice'\n";
1.4 harris41 173: }
174: else {
175: print "Invalid input (only alphanumeric characters supported).\n";
176: }
177: }
1.1 harris41 178:
1.20 ! albertel 179:
! 180: # get domain description
! 181: # accept if valid, if not valid, tell user and repeat
! 182: $flag=0;
! 183:
! 184: while (!$flag) {
! 185: print(<<END);
! 186:
! 187: **** Domain Description ****
! 188: String describing the domain, to be shown to users.
! 189: [Example, msu is Michigan State University]
! 190: ENTER DOMAIN DESCRIPTION:
! 191: END
! 192:
! 193: my $choice=<>;
! 194: chomp($choice);
! 195: if ($choice!~/:/) {
! 196: open(OUT,'>>/tmp/loncapa_updatequery.out');
! 197: print(OUT 'domainDescription'."\t".$choice."\n");
! 198: close(OUT);
! 199: $domainDescription=$choice;
! 200: $flag=1;
! 201: }
! 202: else {
! 203: print "Invalid input (no ':' allowed).\n";
! 204: }
! 205: }
! 206:
1.8 harris41 207: my $lonHostID;
208: if ($lonDefDomain) {
209: $lonHostID=$lonDefDomain.$r.int(1+rand(9)); # should be probably also detect
210: # against the hosts.tab
211: }
212:
1.1 harris41 213: print(<<END);
214:
1.8 harris41 215: **** Machine ID Name ****
216: [this does NOT need to correspond to internet address names;
217: this name MUST be unique to the whole LON-CAPA network;
218: we recommend that you use a name based off of your institution;
219: good examples: "msul1" or "bionetl1";
220: bad examples: "loncapabox" or "studentsinside"]
1.1 harris41 221: END
1.8 harris41 222: # get machine name
1.1 harris41 223: # accept if valid, if not valid, tell user and repeat
1.4 harris41 224: $flag=0;
225: while (!$flag) {
226: if ($ipdomain) {
227: print(<<END);
1.8 harris41 228: ENTER LONCAPA MACHINE ID [$lonHostID]:
1.4 harris41 229: END
230: }
231: else {
232: print(<<END);
1.8 harris41 233: ENTER LONCAPA MACHINE ID:
1.4 harris41 234: END
235: }
236: my $choice=<>;
237: chomp($choice);
1.8 harris41 238: if ($lonHostID and $choice=~/^\s*$/) {
239: $choice=$lonHostID;
1.4 harris41 240: open(OUT,'>>/tmp/loncapa_updatequery.out');
1.8 harris41 241: print(OUT 'lonHostID'."\t".$choice."\n");
1.4 harris41 242: close(OUT);
1.8 harris41 243: $lonHostID=$choice;
1.4 harris41 244: $flag=1;
245: }
246: elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
247: open(OUT,'>>/tmp/loncapa_updatequery.out');
1.8 harris41 248: print(OUT 'lonHostID'."\t".$choice."\n");
1.4 harris41 249: close(OUT);
1.8 harris41 250: $lonHostID=$choice;
1.4 harris41 251: $flag=1;
252: }
253: else {
254: print "Invalid input (only alphanumeric characters supported).\n";
255: }
256: }
1.1 harris41 257:
1.4 harris41 258: # get e-mail address
259: # accept if valid, if not valid, tell user and repeat
260: $flag=0;
1.9 harris41 261: my $lonAdmEMail;
1.4 harris41 262: while (!$flag) {
1.1 harris41 263: print(<<END);
264:
265: **** System Administrator's E-mail ****
266: E-mail address of the person who will manage this machine
1.4 harris41 267: [should be in the form somebody\@somewhere]
1.1 harris41 268: ENTER E-MAIL ADDRESS:
269: END
270:
1.4 harris41 271: my $choice=<>;
272: chomp($choice);
273: if ($choice=~/\@/) {
274: open(OUT,'>>/tmp/loncapa_updatequery.out');
1.9 harris41 275: print(OUT 'lonAdmEMail'."\t".$choice."\n");
1.4 harris41 276: close(OUT);
1.9 harris41 277: $lonAdmEMail=$choice;
1.4 harris41 278: $flag=1;
279: }
280: else {
281: print "Invalid input (this needs to look like an e-mail address!).\n";
282: }
283: }
284:
1.1 harris41 285: # update loncapa.conf
1.7 harris41 286: my $confdir='/etc/httpd/conf/';
287: #my $confdir='';
1.5 harris41 288: my $filename='loncapa.conf';
289: my %perlvar;
290: if (-e "$confdir$filename") {
291: open(CONFIG,'<'.$confdir.$filename) or die("Can't read $confdir$filename");
292: while (my $configline=<CONFIG>) {
293: if ($configline =~ /^[^\#]*PerlSetVar/) {
294: my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
295: chomp($varvalue);
1.12 harris41 296: $perlvar{$varname}=$varvalue if $varvalue!~/^\{\[\[\[\[/;
1.5 harris41 297: }
298: }
299: close(CONFIG);
300: }
301: $perlvar{'lonHostID'}=$lonHostID;
302: $perlvar{'lonDefDomain'}=$lonDefDomain;
1.9 harris41 303: $perlvar{'lonAdmEMail'}=$lonAdmEMail;
1.5 harris41 304: $perlvar{'lonRole'}=$lonRole;
1.16 harris41 305: unless ($perlvar{'lonLoadLim'} and $perlvar{'lonLoadLim'}!~/\{\[\[\[\[/) {
1.5 harris41 306: $perlvar{'lonLoadLim'}='2.00';
307: }
1.16 harris41 308: unless ($perlvar{'lonExpire'} and $perlvar{'lonExpire'}!~/\{\[\[\[\[/) {
1.5 harris41 309: $perlvar{'lonExpire'}='86400';
310: }
1.16 harris41 311: unless ($perlvar{'lonReceipt'} and $perlvar{'lonReceipt'}!~/\{\[\[\[\[/) {
1.5 harris41 312: my $lonReceipt='';
1.11 harris41 313: srand(time ^ $$ ^ unpack "%L*", `ps axww | gzip`);
1.5 harris41 314: my @alnum=(0..9,a..z);
315: foreach my $i (1..20) {
316: $lonReceipt.=$alnum[int(rand(36))];
317: }
318: $perlvar{'lonReceipt'}=$lonReceipt;
319: }
320: open(OUT,">$confdir$filename") or
321: die("Cannot output to $confdir$filename\n");
322: foreach my $key (keys %perlvar) {
323: my $value=$perlvar{$key};
324: print(OUT <<END);
325: PerlSetVar $key $value
326: END
327: }
328: close(OUT);
1.1 harris41 329: }
330: </perlscript>
331: </file>
332: <file>
1.5 harris41 333: <target dist='default'>/</target>
1.1 harris41 334: <perlscript mode='fg'>
335: # read values from loncapa.conf
1.7 harris41 336: my $confdir='/etc/httpd/conf/';
1.5 harris41 337: my $filename='loncapa.conf';
338: my %perlvar;
339: if (-e "$confdir$filename") {
340: open(CONFIG,'<'.$confdir.$filename) or
341: die("Can't read $confdir$filename");
342: while (my $configline=<CONFIG>) {
343: if ($configline =~ /^[^\#]*PerlSetVar/) {
344: my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
345: chomp($varvalue);
346: $perlvar{$varname}=$varvalue;
347: }
348: }
349: close(CONFIG);
350: }
1.16 harris41 351: unless ($perlvar{'lonLoadLim'} and $perlvar{'lonLoadLim'}!~/\{\[\[\[\[/) {
352: $perlvar{'lonLoadLim'}='2.00';
353: }
354: unless ($perlvar{'lonExpire'} and $perlvar{'lonExpire'}!~/\{\[\[\[\[/) {
355: $perlvar{'lonExpire'}='86400';
356: }
357: unless ($perlvar{'lonReceipt'} and $perlvar{'lonReceipt'}!~/\{\[\[\[\[/) {
358: my $lonReceipt='';
359: srand(time ^ $$ ^ unpack "%L*", `ps axww | gzip`);
360: my @alnum=(0..9,a..z);
361: foreach my $i (1..20) {
362: $lonReceipt.=$alnum[int(rand(36))];
363: }
364: $perlvar{'lonReceipt'}=$lonReceipt;
365: }
1.7 harris41 366: my %perlvarstatic;
367: if (-e "${confdir}loncapa_apache.conf") {
368: open(CONFIG,'<'.$confdir.'loncapa_apache.conf') or
369: die("Can't read ${confdir}loncapa_apache.conf");
370: while (my $configline=<CONFIG>) {
371: if ($configline =~ /^[^\#]*PerlSetVar/) {
372: my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
373: chomp($varvalue);
374: $perlvarstatic{$varname}=$varvalue;
375: }
376: }
377: close(CONFIG);
378: }
1.6 harris41 379: # implement editing logic below, interactively
380: # update loncapa.conf until 7 is entered
381:
382: $flag=0;
1.17 harris41 383:
1.6 harris41 384: while (!$flag) {
1.1 harris41 385: print(<<END);
386:
387: ===============================================================================
388: This is now the current configuration of your machine.
1.8 harris41 389: 1) Domain Name: $perlvar{'lonDefDomain'}
1.20 ! albertel 390: 2) Domain Description: $domainDescription
! 391: 3) Machine Name: $perlvar{'lonHostID'}
! 392: 4) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
! 393: 5) Role: $perlvar{'lonRole'}
! 394: 6) Cache Expiration Time: $perlvar{'lonExpire'}
! 395: 7) Server Load: $perlvar{'lonLoadLim'}
! 396: 8) Everything is correct up above
1.6 harris41 397: END
1.17 harris41 398: my $hbug=-1;
399: my $dbug=-1;
400: {
401: my $v=$perlvar{'lonHostID'};
402: $hbug=0;
403: $hbug=1 if $v=~/\W/;
404: $hbug=1 if $v=~/\_/;
405: }
406: {
407: my $v=$1;
408: $dbug=0;
409: $dbug=1 if $v=~/\W/;
410: $dbug=1 if $v=~/\_/;
411: }
412:
413: if ($hbug) {
414: print "**** ERROR **** ".
415: "Invalid lonHostID (should only be letters and/or digits)\n";
416: }
417: if ($dbug) {
418: print "**** ERROR **** ".
419: "Invalid lonDefDomain (should only be letters and/or digits)\n";
420: }
421:
1.6 harris41 422: print(<<END);
1.20 ! albertel 423: ENTER A CHOICE OF 1-7 TO CHANGE, otherwise ENTER 8:
1.1 harris41 424: END
1.5 harris41 425: my $choice=<>;
426: chomp($choice);
1.6 harris41 427: if ($choice==1) {
428: print(<<END);
1.16 harris41 429: 1) Domain Name: $perlvar{'lonDefDomain'}
1.20 ! albertel 430: ENTER NEW VALUE (this is an internal value used to identify a group of
! 431: LON-CAPA machines, it must be alphanumerical, we suggest
! 432: using a part of your actual DNS domain. For example, for
! 433: the machine loncapa.msu.edu, we set the Domain to msu):
1.6 harris41 434: END
435: my $choice2=<>;
436: chomp($choice2);
1.8 harris41 437: $perlvar{'lonDefDomain'}=$choice2;
1.6 harris41 438: }
439: elsif ($choice==2) {
440: print(<<END);
1.20 ! albertel 441: 2) Domain Description: $domainDescription
! 442: ENTER NEW VALUE (this should be a string that describes your domain, spaces
! 443: and punctuation are fine except for ':'):
! 444: END
! 445: my $choice2=<>;
! 446: chomp($choice2);
! 447: $domainDescription=$choice2;
! 448: }
! 449: elsif ($choice==3) {
! 450: print(<<END);
! 451: 3) Machine Name: $perlvar{'lonHostID'}
! 452: ENTER NEW VALUE (this will be the name of the machine in the LON-CAPA network
! 453: it cannot contain any of '_' '-' '.' or ':'. We suggest that
! 454: if you are in the domain 'example' and are the first library
! 455: server you enter 'examplel1') :
1.6 harris41 456: END
457: my $choice2=<>;
458: chomp($choice2);
1.8 harris41 459: $perlvar{'lonHostID'}=$choice2;
1.6 harris41 460: }
1.20 ! albertel 461: elsif ($choice==4) {
1.6 harris41 462: print(<<END);
1.20 ! albertel 463: 4) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
1.6 harris41 464: ENTER NEW VALUE:
465: END
466: my $choice2=<>;
467: chomp($choice2);
1.9 harris41 468: $perlvar{'lonAdmEMail'}=$choice2;
1.6 harris41 469: }
1.20 ! albertel 470: elsif ($choice==5) {
1.6 harris41 471: print(<<END);
1.20 ! albertel 472: 5) Role: $perlvar{'lonRole'}
! 473: ENTER NEW VALUE (this should be either 'access' or 'library'
! 474: if in doubt select 'library'):
1.6 harris41 475: END
476: my $choice2=<>;
477: chomp($choice2);
478: $perlvar{'lonRole'}=$choice2;
479: }
1.20 ! albertel 480: elsif ($choice==6) {
1.6 harris41 481: print(<<END);
1.20 ! albertel 482: 6) Cache Expiration Time: $perlvar{'lonExpire'}
! 483: ENTER NEW VALUE (in seconds, 86400 is a reasonable value):
1.6 harris41 484: END
485: my $choice2=<>;
486: chomp($choice2);
487: $perlvar{'lonExpire'}=$choice2;
488: }
1.20 ! albertel 489: elsif ($choice==7) {
1.6 harris41 490: print(<<END);
1.20 ! albertel 491: 7) Server Load: $perlvar{'lonLoadLim'}
1.6 harris41 492: ENTER NEW VALUE:
493: END
494: my $choice2=<>;
495: chomp($choice2);
496: $perlvar{'lonLoadLim'}=$choice2;
497: }
1.20 ! albertel 498: elsif ($choice==8) {
1.6 harris41 499: $flag=1;
500: }
501: else {
1.1 harris41 502:
1.6 harris41 503: }
504: }
1.7 harris41 505: open(OUT,">$confdir$filename") or
506: die("Cannot output to $confdir$filename\n");
507: foreach my $key (keys %perlvar) {
508: my $value=$perlvar{$key};
1.8 harris41 509: print(OUT <<END) unless $perlvarstatic{$key};
1.7 harris41 510: PerlSetVar $key $value
511: END
512: }
513: close(OUT);
1.1 harris41 514: </perlscript>
515: </file>
516: <file>
517: <target dist='default'>loncom/hosts.tab</target>
518: <perlscript mode='fg'>
519: unless (-l "<TARGET />") {
520: print(<<END);
521:
522: ===============================================================================
523: What hosts.tab would you like to have installed?
524: (hosts.tab is a listing of all other internet machines
525: that a server system considers to be valid server systems
526: on the LON-CAPA network)
527:
528: 1) PRODUCTION - you want to deliver courses today or sometime very soon
529: on this machine
1.5 harris41 530: 2) STAND-ALONE - you want this machine to run in 'stand-alone' mode and
531: not be connected to other LON-CAPA machines for now
532: 3) DEVELOPMENT - you want to play with or explore LON-CAPA
1.6 harris41 533: 4) PRESERVE the existing hosts.tab (/home/httpd/lonTabs/hosts.tab)
1.1 harris41 534:
535: END
536: # Option number 26 will install rawhide_hosts.tab, but
537: # the typical user does not want to be part of an intensive
538: # machine test cluster.
539:
540: # get input
541: # if valid then process, otherwise loop
1.6 harris41 542: my $hostname=`hostname`;chomp($hostname);
543: my $hostaddress=`hostname -i $hostname`;chomp($hostaddress);
544: $flag=0;
545: while (!$flag) {
546: print "ENTER 1, 2, 3, or 4:\n";
547: my $choice=<>;
548: chomp($choice);
1.15 harris41 549: $line2insert=<<END;
1.13 harris41 550: $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress
551: END
1.15 harris41 552: $date=`date -I`; chomp($date);
553: $lonHostID=$perlvar{'lonHostID'};
554: $lonHostID=~s/\W//g;
555: $lineexistflag=0;
556: $hostidexistflag=0;
1.6 harris41 557: if ($choice==1) {
1.15 harris41 558: $lonCluster='production'; $flag=1;
559: }
560: elsif ($choice==2) {
561: $lonCluster='standalone'; $flag=1;
562: open(OUT,'>../'.$lonCluster.'_hosts.tab') or
563: die('file generation error');
564: print(OUT $line2insert);
565: close(OUT);
566: }
567: elsif ($choice==3) {
568: $lonCluster='development'; $flag=1;
569: }
570: elsif ($choice==4) {
571: $lonCluster='existing'; $flag=1;
572: if (-e '/home/httpd/lonTabs/hosts.tab') {
573: `cp /home/httpd/lonTabs/hosts.tab ../existing_hosts.tab`;
574: }
575: else {
576: print <<END;
577: There is no existing /home/httpd/lonTabs/hosts.tab
578: END
579: die('');
580: }
581: }
582: elsif ($choice==26) {
583: $lonCluster='rawhide'; $flag=1;
584: }
585: if ($flag==1) {
1.6 harris41 586: `rm -f ../hosts.tab`;
1.15 harris41 587: open(IN,'<../'.$lonCluster.'_hosts.tab');
1.13 harris41 588: while(<IN>) {
589: if (/^$line2insert$/) {
590: $lineexistflag=1;
591: }
1.15 harris41 592: if (/^$lonHostID\:/) {
1.13 harris41 593: $hostidexistflag=1;
594: }
595: }
596: close(IN);
597: if ($hostidexistflag and !$lineexistflag) {
598: print <<END;
599: WARNING: $lonHostID already exists inside
1.15 harris41 600: loncapa/loncom/${lonCluster}_hosts.tab. The entry inside
601: ${lonCluster}_hosts.tab does not match your settings.
602: The entry inside ${lonCluster}_hosts.tab is being replaced
1.13 harris41 603: with your new values.
604: END
1.15 harris41 605: `grep -v "$lonHostID:" ../${lonCluster}_hosts.tab > ../new_${lonCluster}_hosts.tab`;
606: open(OUT,'>>../new_'.$lonCluster.'_hosts.tab') or
607: die("cannot open loncom/${lonCluster}_hosts.tab for output\n");
1.14 harris41 608: print(OUT $line2insert);
1.20 ! albertel 609: print($line2insert);
1.13 harris41 610: close(OUT);
1.15 harris41 611: `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
1.13 harris41 612: # email appropriate message
1.19 harris41 613: system('ping -c 1 www.lon-capa.org > /dev/null || ping -c 1 www.msu.edu > /dev/null || ping -c 1 www.mit.edu > /dev/null');
614: `echo "REPLACE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "REPLACE:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org` unless $?;
1.13 harris41 615: }
616: elsif ($hostidexistflag and $lineexistflag) {
1.15 harris41 617: print <<END;
618: Entry exists in ${lonCluster}_hosts.tab.
619: END
620: `ln -s ${lonCluster}_hosts.tab ../hosts.tab`;
621: # email appropriate message
622: `echo "STABLEUPDATE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "STABLEUPDATE:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
1.13 harris41 623: }
1.15 harris41 624: elsif (!$hostidexistflag and !$lineexistflag) {
625: print <<END;
626: New entry for $lonCluster.
1.6 harris41 627: END
1.15 harris41 628: `cat ../${lonCluster}_hosts.tab > ../new_${lonCluster}_hosts.tab`;
629: open(OUT,'>../new_'.$lonCluster.'_hosts.tab') or
630: die("cannot open loncom/${lonCluster}_hosts.tab for output\n");
631: print(OUT $line2insert);
632: close(OUT);
633: `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
634: # email appropriate message
635: `echo "INSERT:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "INSERT:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
1.6 harris41 636: }
637: }
638: }
1.1 harris41 639:
640: }
641: </perlscript>
642: </file>
643: </files>
644: </piml>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>