It is currently 15 Dec 2017 8:54


Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 12 Jan 2015 6:56 
I have to create a CMD-script to make a cold backup for Control M7 on a windows machine.
To stop and start the nessasary services is not the problem.
But I have found no indication how do I call the program to make the cold backup.

Can someone give me a hint?

Regards

Klaus :roll:


Top
   
PostPosted: 13 Jan 2015 12:16 
Offline
Nouveau
Nouveau
User avatar

Joined: 26 Apr 2005 12:00
Posts: 696
Location: PARIS
Hi

Here is an example with HOT Backup

Just replace following command
ctmdbbck -p%CTMPWD% -d"%PATHBACK%\HotBackup" -mH
by
ctmdbbck -p%CTMPWD% -d"%PATHBACK%\ColdBackup" -mC

Code:
@echo off
rem ------------------------------------------------------------
rem  Derniere Modification 31/10/2014 par F. YOT
rem  version 1.00
rem ------------------------------------------------------------
rem  Adapté pour la sauvegarde croisée entre deux serveurs Control-M
rem ------------------------------------------------------------
if "%1"=="" goto ERROR
GOTO SUITE

:ERROR
cls
@echo ------------------------------------
@echo  Genback v1.00
@echo ------------------------------------
@echo   Syntaxe de la commande :
@echo .
@echo   genback.sh [EM/CTM] [-SAVE]
@echo   exemple : genback.sh ctm
@echo ------------------------------------
@echo   -SAVE backup files on a Backup Server
@echo ------------------------------------

:SUITE
@echo off
set chaîne=%1
set chaîne=%chaîne:c=C%
set chaîne=%chaîne:t=T%
set chaîne=%chaîne:m=M%
set chaîne=%chaîne:e=E%

if "%chaine%"=="EM" goto EM
if "%chaine%"=="CTM" goto CTM
goto ERROR

rem =======================================================================
:CTM
rem =======================================================================
set PATHTMP=D:\Applis\BMC Software\Control-M Server\Exploit
set PATHCTM=D:\Applis\BMC Software\Control-M Server\ctm_server\exe
set PATHBACK=D:\Applis\BMC Software\Control-M Server\Backups
set PATHCTMDB=D:\Applis\BMC Software\Control-M Server\ctm_server\exe\DBUtils
set CTMPWD=ctmpassword

"%PATHCTMB%\dbustatus" | find "Archive Mode" > "%PATHTMP%\archivestatus.txt"
for /F "tokens=*" %%A IN ('type "%PATHTMP%\archivestatus.txt"') DO Set RESULTMODE=%%A
if "%RESULTMODE%"=="Archive Mode=off" goto ACTIVEARCHIVE
if "%RESULTMODE%"=="Archive Mode=off" goto BACKUPCTM

:ACTIVEARCHIVE
echo Archive Mode is off ...
echo Activating Archive Mode to On in ${FILTEMPCTM}/Backups directory
echo
if not exist "%PATHBACK%" mkdir "%PATHBACK%"
if not exist "%PATHBACK%\Archives" mkdir "%PATHBACK%\Archives"
if not exist "%PATHBACK%\HotBackup" mkdir "%PATHBACK%\HotBackup"
"%PATHCTMDB%\DBUArchive" -ARCHIVE_MODE ON -ARCHIVE_DIRECTORY "%PATHBACK%\Archives" -SILENT Y
shut_ca
shut_ctm
shutdb
startdb
start_ctm
start_ca

:BACKUPCTM
if exist "%PATHBACK%" rmdir /S/Q "%PATHBACK%\HotBackup-prev"
xcopy /V/S/E "%PATHBACK%\HotBackup" "%PATHBACK%\HotBackup-prev"
del /F/Q "%PATHBACK%\Archives\*.*"
ctmdbbck -p%CTMPWD% -d"%PATHBACK%\HotBackup" -mH
goto END

rem =======================================================================
:EM
rem =======================================================================
set PATHEM=D:\Applis\BMC Software\Control-M EM 8.0.00\Default\bin
set PATHBACK=D:\Applis\BMC Software\Control-M EM 8.0.00\Backups
set EMPWD=empassword

if not exist "%PATHBACK%" mkdir "%PATHBACK%"
if not exist "%PATHBACK%\Export" mkdir "%PATHBACK%\Export"

if exist "%PATHBACK%" rmdir /S/Q "%PATHBACK%\Export-prev"
xcopy /V/S/E "%PATHBACK%\Export" "%PATHBACK%\Export-prev"
"%PATHEM%\util" -U emuser -P %EMPWD% -export -type all -dir "%PATHBACK%\Export"
goto END

rem =======================================================================
:END


Top
   
PostPosted: 13 Jan 2015 3:01 
Hi fyot,
many thanks for your sample.
I try it tomorrow.

Kindly regards

Klaus


Top
   
PostPosted: 16 Jan 2015 7:56 
Hi fyot,
now I've made 2 CMD-Scripts, for hot- and cold-backup.
It works fine.

It seems me, that in your sample is an error.
You wrote:
if "%RESULTMODE%"=="Archive Mode=off" goto ACTIVEARCHIVE
if "%RESULTMODE%"=="Archive Mode=off" goto BACKUPCTM

I think it must be
if "%RESULTMODE%"=="Archive Mode=off" goto ACTIVEARCHIVE
if "%RESULTMODE%"=="Archive Mode=on" goto BACKUPCTM

Many thanks and kindly regards

Klaus


Top
   
PostPosted: 19 Jan 2015 9:15 
Offline
Nouveau
Nouveau
User avatar

Joined: 26 Apr 2005 12:00
Posts: 696
Location: PARIS
Hi

Yes, I did this script version to you quickly oing this mistake.
Thanks to the correction.

Regards


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited
The site created by Franck YOT. Images, logo, content and trademarks about Control-M products are property of BMC Software.
All the comments are property of their posters. Images, logo, content and design are © copyright by Scheduler-Usage.com. All Rights Reserved