09-24-2009 02:40 PM
We have a 9 week cycle of backup tapes that are sent daily to an offsite vendor. Each tape needs to be returned to us on the correct day of the next backup cycle. I need to notify the vendor as to when the offisite tapes should be returned. I have been manually filling out forms for them and would like to automate this.
I am writing a VB script to pull the last used tape barcodes, configure the correct date for the tapes to be returned and write this data to a text file.
Does anyone have anything similar written in VB script? I would like to know how to find the tape barcodes that had been used in the last 24 hours?
I am using NetBackup Ent 6.5.3 for Windows.
Thank you,
JT
09-24-2009 02:42 PM
09-24-2009 02:53 PM
09-24-2009 03:19 PM
In ksh:
$sudo bpimmedia -l -tape -d 09/24/2009 17:00:00 -e 09/25/2009 17:00:00 | grep "^FRAG " | awk '{print $9}' | sort -u
In VBS, lots of code, to open files etc...
In DOS:
(excuse the formatting - how do we paste code in this forum?)
@echo off
setlocal enabledelayedexpansion
set z_path=%~dp0
set z_name=%~n0
set z_log=!z_path!!z_name!.log
set z_frg=!z_path!!z_name!.frg
set z_lis=!z_path!!z_name!.lis
set z_med=!z_path!!z_name!.med
set z_out=!z_path!!z_name!.out
set z_srt=!z_path!!z_name!.srt
set z_tmp=!z_path!!z_name!.tmp
if exist "!z_frg!" del "!z_frg!"
if exist "!z_lis!" del "!z_lis!"
if exist "!z_med!" del "!z_med!"
if exist "!z_out!" del "!z_out!"
if exist "!z_srt!" del "!z_srt!"
if exist "!z_tmp!" del "!z_tmp!"
bpimmedia -l -tape -d 09/24/2009 17:00:00 -e 09/25/2009 17:00:00 > "!z_lis!"
find "FRAG " "!z_lis!" > "!z_frg!"
for /f "tokens=1,2,3,4,5,6,7,8,9 skip=2" %%a in ('type "!z_frg!"') do (
echo %%i >> "!z_med!"
)
sort "!z_med!" /o "!z_srt!"
set z_prv=
for /f "tokens=1" %%a in ('type "!z_srt!"') do (
set z_cur=%%a
if not "!z_prv!"=="!z_cur!" (
if not "!z_prv!"=="" (
echo !z_cur! >> "!z_out!"
)
)
set z_prv=!z_cur!
)
if not "!z_prv!"=="!z_cur!" (
if not "!z_prv!"=="" (
echo !z_cur! >> "!z_out!"
)
)
:end
echo+
pause
exit /b
:log
echo !date! !time:~0,8! %~1
echo !date! !time:~0,8! %~1 >> "!z_log!"
goto :eof
09-24-2009 03:22 PM
09-24-2009 03:25 PM
09-24-2009 03:28 PM
09-24-2009 03:37 PM