Windows Backup Script

257 views
Skip to first unread message

MJD

unread,
Aug 10, 2011, 2:15:48 PM8/10/11
to mongodb-user
Does anyone out there have a good windows based backup script they can
point me to?


I have found a bunch of linux and the such scripts...but we have an
instance running on windows.
We didnt want to reinvent the wheel...and depend on the kindness of
strangers.

Thanks
MJD

Ken Egozi

unread,
Aug 10, 2011, 2:42:05 PM8/10/11
to mongod...@googlegroups.com

here's mine (yeah yeah I know - I have to move from 1.7.x to 1.9.x already ...):

cat backup.bat
@echo off
setlocal
set _zipfile_HR=%time:~0,2%
set _zipfile_HR=%_zipfile_HR: =0%

set _zipfile=c:\_data\backup\%1-mongodb.%date:~-4,4%%date:~4,2%%date:~-7,2%T%_zipfile_HR%%time:~3,2%%time:~6,2%.7z

rd .\temp /s /q

c:\_data\mongodb\1.7.5\bin\mongo.exe admin c:\_data\mongodb\scripts\lock-server.js
xcopy c:\_data\mongodb\master\data\%1\*.* .\temp /q /s /y /i 
c:\_data\mongodb\1.7.5\bin\mongo.exe admin c:\_data\mongodb\scripts\unlock-server.js

del c:\_data\backup\%1-mongodb.7z
"\Program Files\7-Zip\7z.exe" a -r %_zipfile% .\temp

copy %_zipfile% C:\_dropbox\Dropbox\powers\kenegozi\data-backup

endlocal

rd .\temp /s /q




=======================
the scripts are trivial:
lock-server.js => db.runCommand({fsync:1,lock:1});
unlock-server.js => db.$cmd.sys.unlock.findOne();



Ken Egozi.
http://kenegozi.com/blog
http://social.sears.com
http://www.musicglue.com
http://www.castleproject.org
http://www.idcc.co.il - הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם




--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


MJD

unread,
Aug 18, 2011, 10:23:24 AM8/18/11
to mongodb-user
Great!
Thanks for posting!

On Aug 10, 2:42 pm, Ken Egozi <egoz...@gmail.com> wrote:
> here's mine (yeah yeah I know - I have to move from 1.7.x to 1.9.x already
> ...):
>
> cat backup.bat
> @echo off
> setlocal
> set _zipfile_HR=%time:~0,2%
> set _zipfile_HR=%_zipfile_HR: =0%
>
> set
> _zipfile=c:\_data\backup\%1-mongodb.%date:~-4,4%%date:~4,2%%date:~-7,2%T%_z ipfile_HR%%time:~3,2%%time:~6,2%.7z
>
> rd .\temp /s /q
>
> c:\_data\mongodb\1.7.5\bin\mongo.exe admin
> c:\_data\mongodb\scripts\lock-server.js
> xcopy c:\_data\mongodb\master\data\%1\*.* .\temp /q /s /y /i
> c:\_data\mongodb\1.7.5\bin\mongo.exe admin
> c:\_data\mongodb\scripts\unlock-server.js
>
> del c:\_data\backup\%1-mongodb.7z
> "\Program Files\7-Zip\7z.exe" a -r %_zipfile% .\temp
>
> copy %_zipfile% C:\_dropbox\Dropbox\powers\kenegozi\data-backup
>
> endlocal
>
> rd .\temp /s /q
>
> =======================
> the scripts are trivial:
> lock-server.js => db.runCommand({fsync:1,lock:1});
> unlock-server.js => db.$cmd.sys.unlock.findOne();
>
> Ken Egozi.http://kenegozi.com/bloghttp://social.sears.comhttp://www.musicglue.comhttp://www.castleproject.orghttp://www.idcc.co.il- הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם
Reply all
Reply to author
Forward
0 new messages