OK, this is a very basic way of doing it :
NOTE:
This assumes you have one robot (at the moment, set for TLD type and robot 0)
If there are multiple robots it gets a bit harder and you have to capture the robot number for each media and then work out the robot control host - that is quite a bit of work, or at least I think it is.
I wrote it on Solaris using ksh - Linux may require a bit of alterantion, not sure as I have no Linux box right at this second.
#!/usr/bin/ksh
>/tmp/robotic_media.txt
>/tmp/eject_medialist.txt
ROBOT_NUM=0
ROBOT_TYPE=tld
vmquery -a |grep "media ID" |awk -F: '{print $2}' |sed "s/^[ \t]*//" |while read MEDIAID
do
if [[ $(echo $(vmquery -m $MEDIAID |grep -i "Robot Type" |awk -F: '{print $2}' |sed "s/^[ \t]*//")) != "NONE - Not Robotic (0)" ]]
then
echo $MEDIAID >>/tmp/robotic_media.txt
fi
done
cat /tmp/robotic_media.txt |while read ROB_MEDIAID
do
if [[ $(echo $(vmquery -m $ROB_MEDIAID |grep -i "Assigned" |awk -F: '{print $2}' |sed "s/^[ \t]*//")) = "---" ]]
then
echo $ROB_MEDIAID >>/tmp/eject_medialist.txt
fi
done
LISTMEDIA=""
cat /tmp/eject_medialist.txt |while read i
do
LISTMEDIA=$LISTMEDIA:$i
done
echo "vmchange -res -multi_eject -verbose -rn $ROBOT_NUM -rt $ROBOT_TYPE -single_cycle -w -ml $(echo $LISTMEDIA |sed 's/^://')"
Martin