• RSS
  • Twitter
  • FaceBook

Security Forums

Log in

FAQ | Search | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

Check My Replication Script

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More

View previous topic :: View next topic  
Author Message
graycat
SF Mod
SF Mod


Joined: 29 Apr 2005
Posts: 16777195
Location: London, UK

Offline

PostPosted: Wed Aug 20, 2008 7:25 pm    Post subject: Check My Replication Script Reply with quote

hey, all

well it's been a long long day so far and I need to get this data replication script working. I think I've nailed it but I'd appreciate someone casting an eye over it just to make sure. Heck, it might even prove useful for someone in the future as its components all work where a couple of £100's worth of software doesn't! Smile lol

Background - we're just taking over a new office and until we get our kit in there they will remain on a different (and dodgy) network and domain. I need to replicate their main data store from their secondary file server to a DR server based in one of our offices and domain. This is to be scheduled to run from 22:00 and must stop by 04:00 each night. Ignore the first run amount of data as that'll be transferred by ext hdd and courier.

Code:
REM   DR_Data_Replication.bat
REM   
REM   Mirrors Server1 share contents from SOURCE_SERVER to TARGET_SERVER.
REM   Creates monthly directory and daily log then e-mails to address(es)
REM   
REM   Written by - Graycat
REM


REM Creating Log Folder
md c:\#Scripts\Logs\Working\

REM Starting Replication .....

REM Replicating "Server1" into "Data_Share" on TARGET_SERVER
Robocopy e:\Server1 \\TARGET_SERVER\Data_Share /MIR /XN /XF AUTORUN.INF /LOG+:c:\#Scripts\Logs\Working\Working.txt /R:3 /rh:2200-0400 /pf

REM Move and rename log
move c:\#Scripts\Logs\Working\Working.txt c:\#Scripts\Logs\%date:~-4,4%\%date:~-7,2%\%date:~-4,4%%date:~-7,2%%date:~0,2%.txt

REM E-mailing Log file
echo DR data replication from SOURCE_SERVER to TARGET_SERVER logs attached. > body.txt
c:\#scripts\mpack.exe -s "DR Replication" -d body.txt -c application/exe -o body.msg c:\#Scripts\Logs\%date:~-4,4%\%date:~-7,2%\%date:~-4,4%%date:~-7,2%%date:~0,2%.txt
c:\#Scripts\bmail.exe -s 192.1.1.245 -f Robocopy@mydomain.com -t me@mydomain.com -h -m body.msg

REM Clean up
del c:\#Scripts\body.msg
del c:\#Scripts\body.txt

Exit


This will then be scheduled to run nightly at 22:00.

To me, that hits all the notes. I've used similar in the past but not quite like this so I'm 90% confident it'll work.

Comments / suggestions welcomed. Smile

Edit: Actually noticed an issue on a test run. The robocopy section will pause if it runs past 0400 but not stop so the rest of the script will not run. Sad any ideas on how to get round this?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More All times are GMT + 2 Hours
Page 1 of 1


 
Jump to:  
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 vote in polls in this forum

Community Area

Log in | Register