Amanda-Users

How to tell if a tape is loaded

2005-11-29 10:01:55
Subject: How to tell if a tape is loaded
From: Yan Seiner <yan AT seiner DOT com>
To: AMANDA Users <amanda-users AT amanda DOT org>
Date: Tue, 29 Nov 2005 06:43:12 -0800
I use a ctontab script to run my backups.

Right now the guts of the script are as follows:

/usr/local/bin/vxaTool /dev/st0 -C 1      //turns on compression
/usr/sbin/amdump SeinerHome
/usr/sbin/amverify SeinerHome
/usr/local/bin/vxaTool /dev/st0 -u      //ejects tape

The problem is that if there is no tape in the drive, the dump fails, but the verify hangs. The next time I insert a tape, the verify completes and ejects the tape....

So, I'd like to add a line to test if the drive is loaded. If it is, continue, if not, generate an error and terminate the script.

I am using a VXA-1 tape drive.

I've been testing

mt -f /dev/nst0 load

which appears to work, returning 0 if the tape is loaded and 2 if it is not....

Is this the 'correct' way to test for a loaded tape? Is there a better way? vxaTool (the VXA toolbox from Ecrix) doesn't have any options to test for loaded tape.

TIA,

--Yan

<Prev in Thread] Current Thread [Next in Thread>