1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/usr/local/bin/perl -w
use blib;
use strict;
use AFS::BOS;
my ($server, $cellname, $bos);
die "Usage: $0 server [cell]\n" if $#ARGV < 0;
$server = shift;
$cellname = shift;
if ($cellname) { $bos = AFS::BOS->new($server, 0, 0, $cellname); }
else { $bos = AFS::BOS->new($server); }
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);
die "not yet tested ... \n";
my ($cell, $hostlist) = $bos->listhosts();
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);
print "Cell name is $cell\n";
my $i = 1;
foreach (@$hostlist) {
print "\tHost $i is $_ \n";
$i++;
}
print "bos->addhost()... \t";
my $ok = $bos->addhost('abc');
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);
print "Return Status: $ok \n";
($cell, $hostlist) = $bos->listhosts();
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);
print "Cell name is $cell\n";
$i = 1;
foreach (@$hostlist) {
print "\tHost $i is $_ \n";
$i++;
}
$bos->DESTROY;
print "Done ... \n";
|