version 1.27, 2003/12/22 12:02:19
|
version 1.29, 2003/12/30 11:44:13
|
Line 36
|
Line 36
|
# lonManage -push <tablename> newfile [host] |
# lonManage -push <tablename> newfile [host] |
# Push <tablename> to the lonTabs directory. Note that |
# Push <tablename> to the lonTabs directory. Note that |
# <tablename> must be one of: |
# <tablename> must be one of: |
# host (hosts.tab) |
# hosts (hosts.tab) |
# domain (domain.tab) |
# domain (domain.tab) |
# |
# |
# lonManage -reinit lonc [host] |
# lonManage -reinit lonc [host] |
Line 65 use English; # Cause I like meaningful
|
Line 65 use English; # Cause I like meaningful
|
use Getopt::Long; |
use Getopt::Long; |
use LondConnection; |
use LondConnection; |
use IO::Poll qw(POLLRDNORM POLLWRNORM POLLIN POLLHUP POLLOUT); |
use IO::Poll qw(POLLRDNORM POLLWRNORM POLLIN POLLHUP POLLOUT); |
|
use IO::File; |
|
|
# File scoped variables: |
# File scoped variables: |
|
|
Line 92 sub Usage {
|
Line 93 sub Usage {
|
lonManage [--myname=host --hosts=table] --push=<tablename> newfile [host] |
lonManage [--myname=host --hosts=table] --push=<tablename> newfile [host] |
Push <tablename> to the lonTabs directory. Note that |
Push <tablename> to the lonTabs directory. Note that |
<tablename> must be one of: |
<tablename> must be one of: |
host (hosts.tab) |
hosts (hosts.tab) |
domain (domain.tab) |
domain (domain.tab) |
|
|
lonManage [--myname=host --hosts=table] --reinit=lonc [host] |
lonManage [--myname=host --hosts=table] --reinit=lonc [host] |
Line 417 sub BuildEditScript {
|
Line 418 sub BuildEditScript {
|
my $TableType = shift; |
my $TableType = shift; |
my $ScriptName = shift; |
my $ScriptName = shift; |
|
|
#Stub |
my $fh = new IO::File "< $ScriptName"; |
|
if (! (defined $fh)) { |
|
print "Unable to open script file: $ScriptName \n"; |
|
Usage; |
|
exit -1; |
|
} |
|
|
my @EditScript = ( |
my @EditScript; |
"$TableType\:append|". |
my $scriptline = "$TableType\:"; # First leads with e.g. hosts: |
"nscll2|nscl\:library\:lonkashy.nscl.msu.edu\:35.8.32.89\n" |
while (! $fh->eof()) { |
."delete|nscll2" |
my $line = <$fh>; |
); |
chomp $line; |
|
if($line ne "\n") { |
|
$scriptline .= "$line\n"; |
|
push(@EditScript, $scriptline); |
|
$scriptline = ""; |
|
} |
|
} |
|
|
return \@EditScript; |
return \@EditScript; |
} |
} |
# Read the loncapa configuration stuff. If ForeignHostTab is empty, |
# Read the loncapa configuration stuff. If ForeignHostTab is empty, |
Line 432 sub BuildEditScript {
|
Line 445 sub BuildEditScript {
|
# is the name of an alternate configuration file to read in |
# is the name of an alternate configuration file to read in |
# standalone mode. |
# standalone mode. |
# |
# |
sub ReadConfig { |
sub ReadConfig { |
|
|
|
|
|
|
Line 516 sub Transact {
|
Line 529 sub Transact {
|
} |
} |
# Body is now built... transact with lond.. |
# Body is now built... transact with lond.. |
|
|
|
# print "Final command: '$request'\n"; |
my $answer = subreply($request, $host); |
my $answer = subreply($request, $host); |
|
|
print "$answer\n"; |
print "$answer\n"; |
Line 560 sub PushFile {
|
Line 574 sub PushFile {
|
my @table = <TABLEFILE>; # These files are pretty small. |
my @table = <TABLEFILE>; # These files are pretty small. |
close TABLEFILE; |
close TABLEFILE; |
|
|
if( ($tablename eq "host") || |
if( ($tablename eq "hosts") || |
($tablename eq "domain")) { |
($tablename eq "domain")) { |
print("Pushing $tablename to $host\n"); |
print("Pushing $tablename to $host\n"); |
Transact($host, "pushfile:$tablename",\@table); |
Transact($host, "pushfile:$tablename",\@table); |