Backup Your Repository
The question of how to back up a repository has come up a few times on the mailing list, so here documented are a couple of user submitted scripts for backing up a CVSNT repository.
Overview
CVSNT stores all the repository in RCS format files. To back up a CVS repository, you should make sure that each of the files can be cleanly backed up and that they don't change while the backup is in progress.
Review the scripts below and see which one, or a combination of both, might be more appropriate for your environment. Once you have decided on the method of the script, you can schedule it to run with the Task Scheduler (Start->Programs->Accessories->System Tools->Scheduled Tasks), AT command, or similar.
NOTE: These scripts represent just the first step in a backup strategy. It is assumed that the server is regularly backed up to external media, and that the output files of this script are included in that backup. Simply backing up a repository to the same drive would NOT be considered a reliable backup. There is no warranty implied or granted by using any of these scripts.
Script 1
This script was submitted by Dave.
FOR /F "TOKENS=2-4 DELIMS=/ " %%F IN ('DATE /T') DO (SET MYDATE=%%F-%%G-%%H)
net stop cvsnt
xcopy "D:\Data Files\CVS\cvsrepo" "D:\Data Files\CVS\cvsbackup" /Q /S /C /H /R /O /Y /I
net start cvsnt
ren "cvsbackup" "cvsbackup %MYDATE%"
Line 1 creates an environment variable that is the current date punctuated with hyphens.
Line 2 stops the service so no one commits while it's backing up.
Line 3 copies the repository to a backup directory with all the correct ownerships, protections, etc.
Line 4 restarts the service.
Line 5 renames the backup repository to include the date in its name.
That's it. Good luck.
Script 2
This script was submitted by Glen Starrett.
@echo off echo Backup CVS repositories echo. echo Stopping service NET STOP CVSNT d: cd \cvs echo Empty TEMP rem Reset temp rmdir /s /q temp > nul md temp > nul echo Y| cacls temp /T /P CVSAdmins:F System:F CVSUsers:F Administrators:F echo Removing very old backup CD backup RD /S/Q old echo Move old backup REN current old MD current echo Backing up each repository... CD ..\repositories FOR /D %%F IN (*) DO c:\utils\zip -rq ..\backup\current\%%F.zip %%F\*.* CD .. NET START CVSNT
This script purges and resets the CVS TEMP directory (and reapplies permissions), rotates the backup directories, then creates one ZIP per repository.

