Das Skript stammt von http://www.freebsddiary.org/tape-library.php und wurde am 13.10.2010 10:37 kopiert
NUMSLOTS=10
FIRSTSLOT=1
CHANGER=/dev/pass4
TAPEDRIVE=/dev/sa1
MTXCHANGER=/usr/local/sbin/mtx-changer
MT=/usr/bin/mt
SLOTS=`jot ${NUMSLOTS} ${FIRSTSLOT} ${NUMSLOTS}`
# or you could this: provided by Marcin Haba
# SLOTS=`${MTXCHANGER} ${CHANGER} list | awk -F ':' '{print $1}'`
# unload any existing tape
for slot in ${SLOTS}
do
echo ${slot}
# load
${MTXCHANGER} ${CHANGER} load ${slot} ${TAPEDRIVE} 0
# erase
${MT} -f ${TAPEDRIVE} rewind
${MT} -f ${TAPEDRIVE} weof
# unload
${MTXCHANGER} ${CHANGER} unload ${slot} ${TAPEDRIVE} 0
doneErklärung:
- NUMSLOTS=10 - this is the number of slots in my tape library.
- FIRSTSLOT=1 - the first slot to deal with
- CHANGER=/dev/pass4 - the device for the tape changer
- TAPEDRIVE=/dev/sa1 - the device for the tape drive
- MTXCHANGER=/usr/local/sbin/mtx-changer - the path to my mtx-changer script
- MT=/usr/bin/mt - the path to the mt(1) binary
SLOTS=jot ${NUMSLOTS} ${FIRSTSLOT} ${NUMSLOTS} - this generates a sequence of 1..10 (for my ten slots)