A script that we at MyTechForum.com use to search for media errors is called tapechk.sh.
# cat tapechk.sh
#!/usr/local/bin/bash
export TODAY=$(date +%m%d%y)
bperror -all -hoursago 24 | nawk -v DATE=`date +%m”/”%d”/”%y` -f tapechk.awk > nbu_problems.$TODAY
PROBS=$(grep problem nbu_problems.$TODAY | nawk ‘{print $1}’)
if [ $PROBS -gt 0 ]
then
cat nbu_problems.$TODAY
mailx -s “NBU Tape / Library Errors $TODAY2” someone@test.com < nbu_problems.$TODAY
else
echo "\n\tThere are not any tape problems.\n"
fi
# cat tapechk.awk
BEGIN {print "\nTape Check - ",DATE; print "\n==========================="}
/^[0-9]/{flg=0; count=0}
/I\/O/{if (NF>=8) tape = $7; if ($1 ~ “[0-9]{6}”) tape = $1; count++; totaltapes+=count; printf(“\nPlease verify the status
of volume %d.\n\n”, tape) ; flg=1}
flg{print}
END{printf(“\n—————————-\n%d tape problem(s) were found\n”,totaltapes)}