script to export tapes from Eternus i500 Scalar Fujitsu


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Script om tapes te exporteren vanuit de robot naar de mailsloten
::
:: Version History
:: 2009/12/11 version 1 Teus
:: 2010/01/11 version 2 Teus
::
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

@echo off

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: GENERAL HOUSEKEEPING ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Set Script Paths
::
:::::::::::::::::::

SET scriptpath=E:\centricstor
SET outputpath=E:\centricstor\out
SET cygwinpath=E:\cygwin\bin
SET robotip=root@172.16.4.130
SET vmquery_path="e:\program files\veritas\volmgr\bin\vmquery"

::::::::::::::::::::
::
:: Set Script Output Files
::
::::::::::::::::::::

set logicaltapes=%outputpath%\logical_tapes.txt
set physicaltapes=%outputpath%\Physical_tapes.txt
set ioslots=%outputpath%\io_slots.txt
set physicaltapesout=%outputpath%\physical_tapes_out.txt
set tapestovault=%outputpath%\tapes_to_vault.bat

:::::::
::
:: Set Script Files
::
:::::::

set volumepools_netbackup=%scriptpath%\volume_pools_netbackup.txt
set volumepools_centricstor=%scriptpath%\volume_pools_centricstor.txt
set dates_script=%scriptpath%\date_today_prev_bprev.vbs
set sortTapes=%scriptpath%\read_tapes.vbs

:::::::::::::::::::
::
:: Benodigde Files indien niet aanwezig script niet uitvoeren.
::
:::::::::::::::::::

IF NOT EXIST %dates_Script% CALL :FOUTEBOEL %dates_script%
IF NOT EXIST %volumepools_netbackup% CALL :FOUTEBOEL %volumepools_netbackup%
IF NOT EXIST %volumepools_centristor% CALL :FOUTEBOEL %volumepools_centristor%
IF NOT EXIST %sortTapes% CALL :FOUTEBOEL %sortTapes%

:::::::::::::::::::
:: Als de volgende bestanden bestaan dan deze verwijderen.
:::::::::::::::::::

IF EXIST %logicaltapes% del /q %logicaltapes% >nul
IF EXIST %physicaltapes% del /q %physicaltapes% >nul
IF EXIST %tapestovault% del /q %tapestovault% >nul
IF EXIST %ioslots% del /q %ioslots% >nul
IF EXIST %physicaltapesout% del /q %physicaltapesout% >nul

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::: END HOUSEKEEPING :::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Actual Script
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Kijken of er voor de netbackup pools tapes zijn gebruikt in de laatste 3 dagen.

FOR /F %%i in (%volumepools_netbackup%) DO (
FOR /F %%a in ('cscript /nologo %dates_Script%') DO (
FOR /F "delims=, " %%x in ('"%vmquery_path% -pn %%i -bx |findstr /i "%%a""') DO (
echo %%x >> %tapes%
)
)
)

:::::::::
:: Todo bepalen welke pool er geexporteerd moet worden
:::::::::

FOR /F %%x in (%volumepools_centristor%) DO (
FOR /F %%a in (%tapes%) DO (
%cygwinpath%\ssh %robotip% plmcmd query -v %%a | findstr /i "%%x" >> %physicaltapes%
)
)

::::::::
:: Tapes sort script / ontdubbelen
::::::::

start /wait %sortTapes%

::::::
:: commando maken om PV op vault te zetten voor export.
::::::

FOR /F "tokens=1,2 delims=, " %%a in (%physicaltapesout%) do echo %cygwinpath%\ssh %robotip% plmcmd conf –E –V %%a -G %%b >> %tapestovault%

::::::
:: commando uitvoeren om PV op vault te zetten voor export.
::::::

start /wait %tapestovault%

::::::::
:: Inventory Jukebox
::::::::

FOR /F %%a in (%physicaltapesout%) do (
%cygwinpath%\ssh %robotip% jukeadm /dev/fsc/CentricStor/c16t000073l1 l s | findstr /i %%a >> %ioslots%
)

:::::::
:: Verplaatsen tapes naar I/O slot
:::::::

SET count=0
FOR /F "delims=:, " %%a in (%ioslots%) do (
Call :s_count %%a
)
GOTO :eof

:s_count
%cygwinpath%\ssh %robotip% jukeadm /dev/fsc/CentricStor/c16t000073l1 m s %1 i %count%
set /a count+=1
GOTO :eof

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:FOUTEBOEL

echo %1 niet aanwezig
pause
EXIT

:eof
exit

Comments

Popular posts from this blog

Exchange Server Error -1018: How Microsoft IT Recovers Damaged Exchange Databases

Server and Domain Isolation Using IPsec and Group Policy

[Solved] The Group Policy client-side extension Internet Explorer Zonemapping failed to execute