Tuesday, July 12, 2011

ssh snapshot netapp

Little script i pieced together to create a snapshot via batch file
Requirement
plink just google for putty ssh


@echo off

echo Note:
echo
echo This batch file will create a snapshot of volumes
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º Created by Tony Unger 6/10/2011 º
echo º V1.0 Initial Release º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ

echo Enter Username:
set /p UserName=

echo Enter Password:
set /p PassWord=



rem ************************* boot_udfdax64db ******************************************************************************************

echo Creating boot_udfdax64db
REM boot_udfdax64db Snapshot

rem creates command to run
echo snap create boot_udfdax64db WedsSnapshot%date:~4,2%%date:~7,2%%date:~10,4%> commands\boot_udfdax64db.txt
rem use plink to ssh tunnel to netapp box and force snapshot
"exe\plink.exe" -ssh -pw %PassWord% -noagent -m commands/boot_udfdax64db.txt %UserName%@172.16.1.1



echo Creating app_udfdax64db
REM app_udfdax64db Snapshot
rem creates command to run
echo snap create app_udfdax64db WedsSnapshot%date:~4,2%%date:~7,2%%date:~10,4%> commands\app_udfdax64db.txt
rem use plink to ssh tunnel to netapp box and force snapshot
"exe\plink.exe" -ssh -pw %PassWord% -noagent -m commands/app_udfdax64db.txt %UserName%@172.16.1.1


rem end

echo Snapshots have completed!

echo Checking if snapshots where configured logs

rem looks to see if snapshot was created on filer
findstr /i "WedsSnapshot%date:~4,2%%date:~7,2%%date:~10,4%" "log\SnapShot_app_udfdax64db.txt"> NUL
if %ERRORLEVEL% EQU 0 (
@echo  app_server  snapshot found!
) else (
@echo Error: app_server NOT snapshot found
)


pause