TapeChanger::MTX - use 'mtx' to manipulate a tape library
use TapeChanger::MTX;
my $loaded = TapeChanger::MTX->loadedtape; print "Currently loaded: $loaded\n" if ($loaded);
TapeChanger::MTX->loadtape('next');
my $nowloaded = TapeChanger::MTX->loadedtape;
print "Currently loaded: $nowloaded\n" if ($nowloaded);
See below for more available functions.
TapeChanger::MTX is a module to manipulate a tape library using the 'mtx' tape library program. It is meant to work with a simple shell/perl script to load and unload tapes as appropriate, and to provide a interface for more complicated programs to do the same. The below functions and variables should do as good a job as explaining this as anything.
This module uses the following functions:
COMMAND is the command you're
trying to send to them. Uses 'warn()' to print the commands to the screen
if $TapeChanger::MTX::DEBUG is set.
SLOT can be any of the following (with the
relevant function indicated):
current C<loadedtape()>
prev C<loadprevtape()>
next C<loadnexttape()>
first C<loadfirsttape()>
last C<loadlasttape()>
0 C<_ejectdrive()>
1..99 Loads the specified tape number, ejecting whatever is
currently in the drive.
DRIVE is the drive to load, and defaults to 0. Returns 0 if
successful, an error string otherwise.
~/.mtxrc is automatically loaded when this module is used, if it exists,
using do(). This could cause security problems if you're trying to use
this with setuid() programs - so just don't do that. If you want someone
to have permission to mess with the tape drive and/or changer, let them
have that permission directly.
Perl 5.6.0 or better, an installed 'mtx' binary, and a tape changer and reader connected to the system.
Support for Input/Export slots is not included, though it may be later. Possibly works for multiple drives per changer, but I haven't tested it, so I probably missed something. 'load previous' doesn't actually work, because mtx doesn't support it (though the help says it does).
mtx, mt, tapechanger. Inspired by stc-changer, which comes with the AMANDA tape backup package (http://www.amanda.org), and MTX, available at http://mtx.sourceforge.net.
Tim Skirvin <tskirvin@uiuc.edu>
Copyright 2001-2002 by the University of Illinois Board of Trustees and Tim Skirvin <tskirvin@ks.uiuc.edu>.