Hi folks.
I am trying to script a query of a backup server that will display sessions that are "waiting" for a mount...
So for, i query my system which returns a process # that is waiting...
The output looks like this:
20,984 Backup Storage Pool Primary Pool T950_TAPE_WIN, Copy Pool T950_VAULT_WIN, Files Backed Up: 561423, Bytes Backed Up: 2,085,547,366,263, Unreadable Files: 0, Unreadable Bytes: 0. Current Physical File (bytes): 5,969,634,749 Waiting for access to input volume 211593L4 (2393 seconds). Current output volume: 210606L4.
I then try to extract the number of seconds it has been waiting. That way, if it is considered too long, i can cancel it...
So far, here is what i have...
PASSWORD=$(cat /etc/security/tsm/.password)
LOGIN="dsmadmc -se=tsm_server -id=admin -password=${PASSWORD} -dataonly=yes -noconfirm -tab"
PROCESS=`${LOGIN} "q proc"|grep Waiting|awk '{print $1}'`
if [[ $PROCESS = "" ]]
then
echo "\nThere are no processes waiting.\n"
else
echo "\nThese are the processes waiting: " $PROCESS
fi
for i in $PROCESS
do
WAITING=`${LOGIN} "q proc $PROCESS" | grep seconds`
echo "\n"$WAITING
#RESULT=$(echo $WAITING | sed -ne '/volume/ s/\((.*seconds)\)\([[:alnum:]]*\)\(.*\)/:\2/gp')
#RESULT=$(echo $WAITING | sed 's/.*\(seconds[^ ;]\);*/\1/')
#RESULT=$(echo $WAITING | sed -n '/Current/,/volume:/p')
echo "\n"$RESULT
done
The result of "$WAITING" is displayed above. I tried sed using examples and the such but the last one i tried is showing me -after- the word "seconds". What i would like is to export the #### of seconds to my $RESULT. keep in mind that the seconds could be 1, 20, 300, 4335 etc...never the same lenght...
There could be 2 "waiting". One "waiting for access to output volume" and one "waiting for access to input volume"
I'd like to grab either or both if possible...
BTW, i am reading through some "sed" doc...but man...:wall:
Thanks.