24 lines
492 B
Bash
Executable file
24 lines
492 B
Bash
Executable file
#!/bin/sh
|
|
|
|
if [ $# -ne 1 ]; then
|
|
echo "Usage: `basename $0` <device>" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
|
|
|
|
DEVICE=$1
|
|
GENERIC=`readlink /sys/class/scsi_tape/\`basename ${DEVICE}\`/device/generic`
|
|
if [ $? -ne 0 ]; then
|
|
echo "ERR: Cannot find tape drive ${DEVICE}" 1>&2
|
|
exit 1
|
|
fi
|
|
GENERIC=/dev/`basename ${GENERIC}`
|
|
|
|
tapeinfo -f ${GENERIC} | fgrep TapeAlert
|
|
if [ $? -eq 1 ]; then
|
|
exit 0
|
|
fi
|
|
|
|
smartctl -H -l error ${GENERIC}
|
|
exit 0
|