#!/usr/bin/sh #set -x # file /var/operlib/adsm/remove_drm # sub to check process to see if it is still running check_process() { process=`dsmadmc -id=$usr -pass=$pw q proc $job1 | grep -c 'MOVE DRMEDIA'` if [ $debug -gt 0 ]; then echo process is $process fi if [ $debug -gt 1 ]; then process=1 echo resetting process to $process fi } # sub to get request number get_request() { request=0 req="" dsmadmc -id=$usr -pass=$pw q request | grep 'Remove 3570' | read x1 req x3 x4 if [ $debug -gt 0 ]; then echo req is $req fi if [ $debug -gt 1 ]; then req="026:" echo resetting req to $req fi if [ "X${req}" != "X" ]; then len=`expr length $req` len=`expr $len - 1` req=`expr substr $req 1 $len` request=`expr $req + 0` fi if [ $debug -gt 0 ]; then echo request is $request fi if [ $debug -gt 1 ]; then request=1 echo resetting request to $request fi } # debug - 0 no debug 1-print 2-simulate debug=0 lib=lib0 if [ $debug -gt 0 ]; then echo debug is on and set to $debug echo library to use is $lib fi cat /etc/adsm/adsm | read usr pw CMD="dsmadmc -id=$usr -password=$pw" CMD1="dsmadmc -id=$usr -password=$pw -comma " $CMD "move drm * wherestate=mountable tostate=vault remove=untileefull" > /tmp/checkout_log if [ $? -eq 0 ]; then RETRY=0 sleep 30 while true do $CMD q request > /tmp/checkout_ask grep ANR8322I /tmp/checkout_ask > /dev/null if [ $? -eq 0 ]; then RETRY=0 grep ANR8322I /tmp/checkout_ask |grep "Remove LTO volume" |awk '{print $2}' > /tmp/checkout_reply COMMAND=`sed s/://g /tmp/checkout_reply` $CMD "reply $COMMAND" > /dev/null rm /tmp/checkout_* sleep 30 else # now check if move drm is still running - if not quit i=`$CMD1 "q proc " | /var/operlib/adsm/cleanhdrs | grep -c "MOVE DRMEDIA"` if [ "$i" = "0" ]; then rm /tmp/checkout_* break fi rm /tmp/checkout_* sleep 30 # if (( $RETRY<30 )) ; then # RETRY=`expr $RETRY + 1` # else # break # fi fi done fi