Coding with passion

首页 新随笔 联系 订阅 管理

For our source's security, an adminstrator of Microsoft Visual SourceSafe should do a backup daily or weekly at least. The backup process won't cost us a long time, but we prefer automatical backup for sure. Let's introduce how to implement a daily backup by making use of existing tools.

  • Tools
    • ssarc.exe. ssarc.exe is a backup tool offered by SoureSafe. It's in "win32" directory which is under the installation path of SouceSafe.
    • schtasks. In Windows Server 2003, schtasks allows an administrator creating, deleting, querying, configurng, running and stopping local or remote scheduled tasks in system. It is designed to replace at.exe.
  • Steps
    • Create a batch file names as "backup.bat" in "c:\backup\bin" directory;
    • Write the following commands into the file:
      1 @echo off
      2 @title Backing up SourceSafe databases
      3 set SsPath=C:\Program Files\Microsoft Visual Studio\VSS\win32\
      4 set BakPath=C:\backup\content\
      5 "%SsPath%ssarc.exe" –d- -s"Path to a SourceSafe Database" –i- -yadmin,password 
      6 –o@"%BakPath%Backup-output(%DATE%).txt" "%BakPath%Backup-Database(%DATE%).ssa" $/
      7 echo Finished backups
      8 @echo on

      Note:

      • SsPath designates the path to the "win32" directory.
      • BakPath appoints the path where backup files are preserved.
      • You should replace "Path to a SourceSafe Database" as the path to the "SrcSafe.ini" of a SourceSafe database.
      • Please replace "Password" as the administrator's password.
      • After a backup process, there will be two generated files under "c:\backup\content":
        Backup-output(2004-11-01).txt: the output file
        Backup-Database(2004-11-01).ssa: the backup file generated by SourceSafe.

        2004-11-01 appoints the date when the backup operation is carrying out.

       

    • Use schtasks to create a scheduled task.
      1
      2schtasks /create /RU system /SC DAILY /ST 12:00 /TN "SourceSafe Backup" /TR "cmd /c C:\backup\bin\backup.bat"
      3

      Note:

      • /RU system, run the command under "NT AUTHORITY\SYSTEM" account.
      • /SC DAILY, run the command one time a day. Valid values are MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE.
      • /ST 12:00 specifies the program will be started at 12:00.
      • /TN "SourceSafe Backup" specifies the name of the scheduled task.
      • /TR "cmd /c c:\backup\bin\backup.bat" specifies the program to be executed.

       

    • Congratulations, you have successfully created a scheduled task to implement the daily backup process. When type "schtasks" at command line, you can find "SourceSafe Backup" in the column called "Task Name".
  • References
posted on 2007-08-27 22:58  Kellin  阅读(368)  评论(0编辑  收藏  举报