Article
· Feb 24, 2016 1m read

Script sample for running an external Caché / Ensemble backup on Windows (using ##Class(Backup.General).ExternalFreeze() / ExternalThaw())

C:\data\backup.bat :

C:\InterSystems\Ensemble\bin\cache -s"C:\InterSystems\Ensemble\Mgr" -U%%SYS ##Class(Backup.General).ExternalFreeze() <C:\data\login.scr 

echo %ERRORLEVEL%

rem note that we need to check errorlevel from highest to lowest here....

if errorlevel 5 goto OK

if errorlevel 3 goto FAIL

echo errorlevel returned wrong value

goto END

:OK

echo SYSTEM IS FROZEN

xcopy c:\InterSystems\Ensemble\mgr\ z:\backup\Ensemble /s /e /y /i

echo %ERRORLEVEL%

goto END

:FAIL

echo SYSTEM FREEZE FAILED

:END

rem Now unfreeze the system

C:\InterSystems\Ensemble\bin\cache -s"C:\InterSystems\Ensemble\Mgr" -U%%SYS ##Class(Backup.General).ExternalThaw() <C:\data\login.scr

echo %ERRORLEVEL%

if errorlevel 5 goto RESUMEOK

if errorlevel 3 goto RESUMEFAIL

echo errorlevel returned wrong value

goto RESUMEEND

:RESUMEOK

echo SYSTEM IS RESUMED

goto RESUMEEND

:RESUMEFAIL

echo SYSTEM RESUME FAILED

:RESUMEEND

NB: the external backup command  (here xcopy) should be customized depending on available OS commands or external SAN available.

C:\data\login.scr :

_system

SYS

Discussion (0)1
Log in or sign up to continue