In order to find a list of tapes to remove from my LTO every morning, and update their 
DRM status, I use a script. Here is the relevant code. The actual script is much 
longer and does several things. My script will creates another KSH script.

Code:

CHECKOUT=/tmp/update_checkout_status.`date +%d%b%Y`
OUTPUT_FILE=/tmp/tapes_to_remove.`date +%d%b%Y`
dsmadmc -id=query -password=query q actlog begint=08:00 endt=08:40 | grep -i "from 
slot" | sed "s/  / /g" | sed "s/  / /g" | sort -t" " +9 -n   >$OUTPUT_FILE
cat $OUTPUT_FILE | sed "s/^/echo /"                                                    
                                                                                       
                           >>$CHECKOUT.1
cat $OUTPUT_FILE | cut -f 7 -d " " | sort | sed "s/^/dsmadmc -id=\$ID 
-password=\$PASSWORD move drmedia /"                                             
>$CHECKOUT.2
cat $CHECKOUT.2 | sed "s/$/ tostate=vault | grep -i return/"                           
                                                                                       
               >$CHECKOUT.3
cat $CHECKOUT.1 $CHECKOUT.3                                                            
                                                                                       
                          > $CHECKOUT

The idea is to parse the actlog. Find the cartridges names, then add 'move drmedia' 
and 'tostate=vault' around the cartridge name.

Miles


----------------------------------------------------------------------------------------------
Miles Purdy 
System Manager
Farm Income Programs Directorate
Winnipeg, MB, CA
[EMAIL PROTECTED]
ph: (204) 984-1602 fax: (204) 983-7557

"If you hold a UNIX shell up to your ear, can you hear the C?"
-------------------------------------------------------------------------------------------------

>>> [EMAIL PROTECTED] 09-Jul-02 10:00:16 AM >>>
Hopefully a simple question:

I have a select script that finds the tapes I want to be processed by
MOV DRM, is there a way to pipe the results from the select back into
that command? Here's the select:

select volume_name,state from drmedia where (volume_name in (select
volume_name from volumes where status='FULL') and state='MOUNTABLE') or
volume_name in (select volume_name from libvolumes where
last_use='DbBackup')

And I want the volumes returned from that to be processed by MOV DRM.

The other option would be outputting to a tmp file and creating a
command for each volume, but that seems more complicated than it should
be.

Steve Cochran
Dartmouth College

Reply via email to