AFS-Command

 view release on metacpan or  search on metacpan

lib/AFS/Command/BOS.pod  view on Meta::CPAN

Each of these objects has the following attributes and methods:

B<AFS::Object::BosServer>

This object is nothing more than a container for the generic objects
for each file.  It has several methods for extracting the file objects:

    Methods			Returns
    -------			-------
    getFileNames()		a list of filenames
    getFiles()			a list of AFS::Object objects
    getFile($filename)		the AFS::Object object for $filename

B<AFS::Object>

The following attributes should always be present:

    Attributes			Values
    ----------			------
    file			fully qualified pathname to the file
    date			last modified timestamp on the file

The following attributes may be present, if there are .BAK or .OLD
versions of the file.

    Attributes			Values
    ----------			------
    bak				last modified timestamp on the .BAK file
    old				last modified timestamp on the .OLD file

=back

=head2 getlog

=over

=item Arguments

The bos help string is:

    bos getlog: examine log file
    Usage: bos getlog -server <machine name> -file <log file to examine>
		      [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

    my $result = $bos->getlog
      (
       # Required arguments
       server			=> $server,
       file			=> $file,
       # Optional arguments
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
       # Enhanced arguments
       redirect			=> $redirect,
      );

The 'redirect' argument is the name of a file to "redirect" the log
file to.  By default, 'bos getlog' dumps the contents of the requested
file to stdout, which is not what you normally want in an application.
The value of this argument is passed directly to IO::File->open().

If this argument is not specified, then the contents of the logfile
are stashed in an attribute of the returned object.

=item Return Values

This method returns an AFS::Object::BosServer object, which
contains one attribute.

    my $result = $bos->getlog
      (
       server			=> $server,
       file			=> "/usr/afs/logs/VolserLog",
       redirect			=> "/var/tmp/VolserLog.$$",
      ) || die $bos->errors();

    my $logfile = IO::File->new("</var/tmp/VolserLog.$$") ||
      die "Unable to open logfile: $ERRNO\n";

    while ( defined($_ = $logfile->getline()) ) {
	....
    }

    # Alternately, the memory pig way:

    my $result = $bos->getlog
      (
       server			=> $server,
       file			=> "/usr/afs/logs/VolserLog",
      );

    foreach ( split(/\n+/,$result->log()) ) {
	....
    }

The object has the following attribute:

B<AFS::Object::BosServer>

    Attributes			Values
    ----------			------
    log				Contents of the logfile, or the redirect pathname

If redirect was given, then this attribute is simply same pathname.
If redirect was not given, then the value of this attribute is the
contents of the requested logfile, as a single (potentially huge)
string.

NOTE: Since this method is usually invoked to retrieve one of the AFS
logfiles, which can be enormous on heavily loaded servers that have
not been restarted in a while, use of the redirect option is strongly
encouraged.  If not used, the memory allocated to store the logfile
may be prohibitively large.  Developer beware.

=back

=head2 getrestart



( run in 1.145 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )