Custom library commands, Configuring a random tape library, Scre – Storix Software SBAdmin User Guide User Manual
Page 68

Custom Library Commands
You may choose to use or create different tape utility commands than the standard “mtx” and “tapeutil”
commands that SBAdmin recognizes. However, you must add the names of the commands to execute to a
configuration file on the server (if remote) to which the library is attached. To add a new tape library
command, edit the /storix/config/library_cmds file (where /storix is replaced with your data directory if
configured differently), and add the name of the library command. You may not insert the full pathname of
the command, so you should copy or link your command to the /usr/bin directory to be sure it is found in the
standard command search path.
The variables listed below are optional and can be used to create custom scripts to run in the place of your
standard library utilities:
DEVICE: This keyword will be replaced with the name of the backup device (the device your library is
assigned to).
TAPEDEV: This keyword will be replaced with the physical tape drive name known by the system. (i.e.
st0, rmt0). For libraries with more than one drive, the TAPEDEV will reference the specific drive a tape
is being moved to or from.
SERVER: This keyword will be replaced with a server name, if your backup device is remote.
CLIENT: This keyword will be replaced with a client name when performing a backup of a client (only if
Network Edition license is used).
BACKUPID: This keyword will be replaced with the Backup ID number when a backup is being
performed.
JOBID: This keyword will be replaced with the current job id number when a backup is being
performed.
For example, if you create a script called “mytapeutility”, place it in /usr/bin and add it to the
/storix/config/library_cmds file), you may specify this command in the
mytapeutil get LIBDEV DRIVE TAPE DEVICE TAPEDEV SERVER /tmp/liblog
And “mytapeutility” could be a script such as the following:
Storix System Backup Administrator
68
Version 8.2 User Guide
#!/bin/sh
action=$1
libdev=$2
drivenum=$3
tapenum=$4
devname=$5
tapedevname=$6
server=$7
log=$8
if [ $action = get ]
then cmd=”mtx –f $libdev load $tapenum $drivenum”
echo “Moving tape #$tapenum to drive #$drivenum” >>$log
else cmd=”mtx –f $libdev unload $tapenum $drivenum”
echo “Returning tape #$tapenum from drive #$drivenum” >>$log
fi
echo “Server is $server, device is $tapedevname ($devname)” >>$log
echo “Executing: $cmd” >> $log
$cmd
exit $?