OK, here is the script... I would do some major testing with it before running it for good! If nothing else, it will show you how to do what you want... If there are pools that you don't want changed to the scratch pool, ensure you take that into account.
Good luck!
#! /bin/ksh
# This is a script to regularly convert unassigned tapes(expired)
# from any pool back to Scratch pool. NetBackup unassigns volumes
# after there retention has expired, but it leaves the tapes in the
# assigned pool for re use. It is better to move them into the Scratch
# pool so other classes can use them. We Currently do not have enough
# enough tapes residing in the Library. It is important that every
# expired tape be re-used quickly for other backup jobs to complete
# successfully.
MEDIADIR='/usr/openv/volmgr/bin'
TEMPDIR='/tmp'
#----------------------------------------
# generate medialist from robot-0 (L700)|
#----------------------------------------
echo "querying L700 robot..."
$MEDIADIR/vmquery -bx -rn 0 | grep '\-\-\- \-\-\-' | grep -v CLN | grep -v Scratch | grep -v NBDB-Offsite | awk '{print $1}' \
> $TEMPDIR/medialist
#----------------------------
# place date at top of file |
#----------------------------
date >> $TEMPDIR/mediacon
for media in `cat $TEMPDIR/medialist`
do
echo " Converting $media to Scratch Pool..."
$MEDIADIR/vmchange -p 3 -m $media
echo $media' converted to Scratch Pool' >> $TEMPDIR/mediacon
done
#-----------------------------------
# clean up and delete working file |
#-----------------------------------
rm $TEMPDIR/medialist
echo " "
echo " *** Done converting expired tapes to Scratch. ***"