Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cloning scripts

Status
Not open for further replies.

jimgordon

Technical User
Apr 1, 2003
3
GB
I have a windows 2000 server with networker 6.1.3, I backup all my data nightly to an STK-LTO80. I would like to clone my nightly backups to another silo an STL-9714 during the next day. I understand there are 3 ways to clone. manually - no good to me, once a savegrp has completed - again no good as I need all my drives for backups.Or an automatic script, to clone all savegrps, starting when the groups have completed. This is my problem, my knowledge is in unix and could write a script for that, does anyone know what I would use to automate clones on W2K.

Jim Gordon
 
Hi,

Depending on how you wanted to clone, you can dump a list of the save sets to a file with mminfo, and use:

nsrclone -S -f <ssidlist.txt>

You can also list volume names or volid's. Depending on how many drives you have available, and the amount of data you have to clone, you may want to split this up into several clone instances.

Hope this helps.

-ag100
 
I included my scripts for clonning. Take a look, it may save you some time. When it starts it checks if savegroups are running. Then it creates a report file with all back-up savesets. Then it devides all savesets to three groups. Two of them are used to run clonning on two separate tape drives. Third one runs on the next day and used to clone all &quot;big&quot; savesets, located on multiple volumes.

Basicay, you need a few commands :
mminfo
clone
for /F

If you need more information, let me know.

------------------------------------
Main script:
-------------------------------------
@echo off

REM
REM ------------ Run report -----------------
REM

set NW_REPORT_FILE=

for /F &quot;usebackq tokens=1-4 delims=/ &quot; %%a in (`date /T`) do set NW_REPORT_FILE=c:\Reports\%%d-%%b-%%c.txt

goto GOCHECK

:GOWAIT

Sleep 60

for /F &quot;usebackq tokens=1 delims=: &quot; %%t in (`time /T`) do if %%t==1 goto GOEXIT

REM
REM Check SaveGroup Status
REM

:GOCHECK

for /F &quot;usebackq tokens=1-3 delims=:; &quot; %%a in (`nsradmin -s cvh-backup -i c:\clone\grouplist.txt`) do if not

%%b==idle goto GOWAIT

mminfo -s cvh-backup -o cn -t &quot;yesterday 19:55:00&quot; -r &quot;client(16),name(40),totalsize&quot; -q &quot;!incomplete&quot; >

%NW_REPORT_FILE%

REM
REM ------------ Do cloning -------------------
REM
REM ------------ Check Date -----------------
REM



for /F &quot;usebackq tokens=1&quot; %%a in (`date /T`) do if not %%a==Sun goto DOMon

REM
REM ------------ Sunday --------------------
REM
REM ------------ Get ssid list -----------------
REM

if exist c:\clone\ssid.txt del c:\clone\ssid.txt 2>&1 > nul
if exist c:\clone\ssiddup.txt del c:\clone\ssiddup.txt 2>&1 > nul
if exist c:\clone\ssid-tmp.txt del c:\clone\ssid-tmp.txt 2>&1 > nul

for /F &quot;tokens=1&quot; %%c in (C:\Clone\clientlist.txt) do mminfo -s cvh-backup -r

&quot;ssid,volume,pssid,sumflags,ssflags,client,name&quot; -t &quot;yesterday 19:55:00&quot; -q &quot;pool=DAILY,!incomplete,client=%%c&quot; |

find /v &quot;ssid&quot; >> c:\clone\ssid.txt

REM
REM ----------- Remove &quot;recoverable&quot; save sets ----------------
REM --- 1) a - ssid
REM --- 2) b - volume
REM --- 3) c - pssid
REM --- 4) d - sumflags
REM --- 5) e - ssflags
REM --- 6) f - client, name
REM

for /F &quot;tokens=1-5,*&quot; %%a in (C:\Clone\ssid.txt) do if not %%d==cr echo %%a %%b %%c %%d %%e

%%f>>c:\clone\ssid-tmp.txt

if exist c:\clone\ssid.txt del c:\clone\ssid.txt 2>&1 > nul
ren c:\clone\ssid-tmp.txt ssid.txt 2>&1 > nul

REM
REM ----------- Separate &quot;continued&quot; save sets -------------------
REM

for /F &quot;tokens=1-5,*&quot; %%a in (C:\Clone\ssid.txt) do if %%e==CvF echo %%a %%b %%c %%d %%e %%f>>c:\clone\ssiddup.txt

for /F &quot;tokens=1-5,*&quot; %%a in (C:\Clone\ssid.txt) do if not %%e==CvF echo %%a %%b %%c %%d %%e %%f

>>c:\clone\ssid-tmp.txt

if exist c:\clone\ssid.txt del c:\clone\ssid.txt 2>&1 > nul
ren c:\clone\ssid-tmp.txt ssid.txt 2>&1 > nul

REM
REM ----------- Separate &quot;head&quot;, &quot;middle&quot;, &quot;tail&quot; save sets ---------------
REM

for /F &quot;tokens=1-5,*&quot; %%a in (C:\Clone\ssid.txt) do if not %%d==cb echo %%a %%b %%c %%d %%e %%f>>c:\clone\ssiddup.txt

for /F &quot;tokens=1-5,*&quot; %%a in (C:\Clone\ssid.txt) do if %%d==cb echo %%a %%b %%c %%d %%e %%f >>c:\clone\ssid-tmp.txt

if exist c:\clone\ssid.txt del c:\clone\ssid.txt 2>&1 > nul
ren c:\clone\ssid-tmp.txt ssid.txt 2>&1 > nul

REM
REM ----------- Separate &quot;series&quot; save sets ----------------------
REM

for /F &quot;tokens=1-5,*&quot; %%a in (C:\Clone\ssid.txt) do if not %%c==0 echo %%a %%b %%c %%d %%e %%f>>c:\clone\ssiddup.txt

for /F &quot;tokens=1-5,*&quot; %%a in (C:\Clone\ssid.txt) do if %%c==0 echo %%a %%b %%c %%d %%e %%f >>c:\clone\ssid-tmp.txt

if exist c:\clone\ssid.txt del c:\clone\ssid.txt 2>&1 > nul
ren c:\clone\ssid-tmp.txt ssid.txt 2>&1 > nul

REM
REM ----------- Get ssid by volumes -----------------
REM

del c:\clone\*.vol /q 2>&1 > nul

for /F &quot;tokens=1,2&quot; %%a in (C:\Clone\ssid.txt) do echo %%a >> C:\Clone\%%b.vol

REM
REM ----------- Create volumes list -------------------
REM

dir c:\clone\*.vol /b /on > C:\Clone\volumelist.txt

set NW_VOLUME_LIST=

for /F &quot;tokens=1 delims=. &quot; %%v in (C:\Clone\volumelist.txt) do call C:\Clone\makevlist.bat %%v

REM
REM ----------- Create 2 lists -------------------
REM

call C:\Clone\make2lists.bat %NW_VOLUME_LIST%

REM
REM ----------- Start cloning -------------------
REM

if exist C:\Clone\clone1.txt del C:\Clone\clone1.txt 2>&1 > nul
if exist C:\Clone\clone2.txt del C:\Clone\clone2.txt 2>&1 > nul

start &quot;Cloning 1&quot; C:\Clone\clone1.bat
start &quot;Cloning 2&quot; C:\Clone\clone2.bat

REM
REM ----------- Checking status -------------------
REM

:GOWAITCLONE

sleep 60

if not exist C:\Clone\clone1.txt goto GOWAITCLONE else if not exist C:\Clone\clone2.txt goto GOWAITCLONE

goto :EOF

REM
REM ------------ Monday -----------------
REM

:DOMon

REM
REM ------------ Check Date -----------------
REM

for /F &quot;usebackq tokens=1&quot; %%a in (`date /T`) do if not %%a==Mon goto DOTue

REM
REM ----------- Start cloning (dup) -------------------
REM

if not exist C:\Clone\ssiddup.txt goto :EOF

if exist c:\clone\ssid-tmp.txt del c:\clone\ssid-tmp.txt 2>&1 > nul

for /F &quot;tokens=1&quot; %%a in (C:\Clone\ssiddup.txt) do echo %%a >> C:\Clone\ssid-tmp.txt

if exist c:\clone\ssiddup.txt del c:\clone\ssiddup.txt 2>&1 > nul

ren c:\clone\ssid-tmp.txt ssiddup.txt 2>&1 > nul

nsrclone -vv -b DAILYCLONE -S -f C:\Clone\ssiddup.txt

goto :EOF

REM
REM ------------ Tuesday ---------------------
REM

:DOTue

goto :EOF

:GOEXIT

date /t > %NW_REPORT_FILE%
time /t >> %NW_REPORT_FILE%
echo Group(s) still running >> %NW_REPORT_FILE%

goto :EOF


---------------------------------
MAKE2LISTS.BAT:
----------------------------------


if exist C:\Clone\ssid1.txt del C:\Clone\ssid1.txt 2>&1 > nul
if exist C:\Clone\ssid2.txt del C:\Clone\ssid2.txt 2>&1 > nul

:DOAGAIN

if &quot;%1&quot;==&quot;&quot; goto DOEND

type C:\Clone\%1.vol >> C:\Clone\ssid1.txt

if &quot;%2&quot;==&quot;&quot; goto DOEND

type C:\Clone\%2.vol >> C:\Clone\ssid2.txt

shift
shift

goto DOAGAIN

:DOEND

-----------------------------------
MAKEVLIST.BAT
-----------------------------------

set NW_VOLUME_LIST=%1 %NW_VOLUME_LIST%

-----------------------------
CLONE1.bat
-----------------------------
REM Run clone for ssids from the file

@ echo on

if exist c:\clone\ssid1.txt nsrclone -vv -b DAILYCLONE -S -f c:\clone\ssid1.txt

echo Done > C:\Clone\clone1.txt

exit

---------------------------------
clone2.bat
---------------------------------
REM Run clone for ssids from the file

@echo on

if exist c:\clone\ssid2.txt nsrclone -vv -b DAILYCLONE -S -f c:\clone\ssid2.txt

echo Done > C:\Clone\clone2.txt

exit





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top