Linker IT Software
Google
Web www.oraxcel.com
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
Building a batch backup job with Synctoy (Read 13570 times)
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Building a batch backup job with Synctoy
26.06.07 at 16:22:36
 
Building a batch backup job with Synctoy
 
I have used the Miscrosoft power toy Synctoy program (ref: http://www.microsoft.com/windowsxp/using/digitalphotography/prophoto/synctoy.msp x) to make an efficient backup batch job. I recently purchased a large network attached storage (NAS). (ref: http://www.oraxcel.com/cgi-bin/yabb2/YaBB.pl?num=1178819917)
 
Until recently I used a backup method whereby I created disk images on each PC on a schedule. I then used a batch file on a spare PC to fetch all the disk images across the network. For this solution see: http://www.oraxcel.com/cgi-bin/yabb2/YaBB.pl?num=1142245564
 
For the partitions on my NAS that I want to backup I have created a synch task in the Synctoy program. One called data, one called archive and one called email.  
I can run these synctoy tasks from a batch file using the commands:
Code:
start /wait g:\synctoy\synctoy -Rdata
start /wait g:\synctoy\synctoy -Remail
start /wait g:\synctoy\synctoy -Rarchief
 


 
Note that I have used the /wait parameter to force the start command to wait until the synctoy task is finished. The -R switch allows a specific synctoy task to be selected. Omitting the task and just running it with -R will run all synctoy tasks.
 
My full solution is this:

  • On old PC was fitted with some old disks and with a copy of Windows XP
  • In the BIOS settings menu I specified that the computer should boot after a power failure.
  • I operate the PC on a timer. Power on at about 19:00 hrs and power off two hours later.
  • On the timer at 19:00 the PC starts up
  • I configured windows to automatically log on. See for details:
    http://www.oraxcel.com/cgi-bin/yabb2/YaBB.pl?num=1149154321
  • I added the following batch file to the autorun group in the start menu:
    Code:
     rem delay
    ping 1.1.1.1 -n 1 -w 5000 >NUL
    
    g:
    cd \backup
    call synctoy.bat
    call shutdown.vbs
     
    
    

    Explanation:
    Pinging 1.1.1.1 will fail and it will give me a delay before the copying starts. After windows is started I need a few seconds for the network connection to establish.
    After the delay I will call the synctoy.bat to do the synctoy jobs. Finally a shutdown.vbs command will cause the PC to shutdown.
  • The synctoy.bat file as previously explained contains the following lines:
    Code:
    start /wait g:\synctoy\synctoy -Rdata
    start /wait g:\synctoy\synctoy -Remail
    start /wait g:\synctoy\synctoy -Rarchief
     
    
    

  • Finally the shutdown.vbs file contains the following text:
    Code:
    ' use "." for local computer 
    ' Use "PowerOff_Force" for a forced poweroff 
    ShutDown ".", "PowerOff" 
    
    
    Sub ShutDown(sNode, sAction) 
    
    
      Const EWX_LOGOFF = 0 
      Const EWX_SHUTDOWN = 1 
      Const EWX_REBOOT = 2 
      Const EWX_FORCE = 4 
      Const EWX_POWEROFF = 8 
    
    
      Set oWMI = GetObject("winmgmts:" _ 
         & "{impersonationLevel=impersonate,(Shutdown)}!\\" _ 
         & sNode & "\root\cimv2") 
    
    
      Set colOperatingSystems = oWMI.ExecQuery _ 
         ("Select * from Win32_OperatingSystem") 
      For Each obj in colOperatingSystems 
        Set oOS = obj :  Exit For 
      Next 
    
    
      sAction = LCase(sAction) 
    
    
      Select Case sAction 
        Case "logoff" 
    	iCmd = EWX_LOGOFF 
        Case "logoff_force" 
    	iCmd = EWX_LOGOFF + EWX_FORCE 
        Case "shutdown" 
    	iCmd = EWX_SHUTDOWN 
        Case "shutdown_force" 
    	iCmd = EWX_SHUTDOWN + EWX_FORCE 
        Case "reboot" 
    	iCmd = EWX_REBOOT 
        Case "reboot_force" 
    	iCmd = EWX_REBOOT + EWX_FORCE 
        Case "poweroff" 
    	iCmd = EWX_POWEROFF 
        Case "poweroff_force" 
    	iCmd = EWX_POWEROFF + EWX_FORCE 
        Case Else 
    	' Default value 
    	iCmd = EWX_POWEROFF 
      End Select 
    
    
      oOS.Win32shutdown iCmd 
    End Sub 
     
    
    

     
Back to top
 
« Last Edit: 26.06.07 at 16:51:47 by Gerrit-Jan Linker »  

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Re: Building a batch backup job with Synctoy
Reply #1 - 09.12.07 at 15:38:01
 
My experience with using Synctoy for backups is that Synctoy jobs sometimes hang. I have decided to not use a GUI tool for backups and I found the robocopy utility in the windows resource kit. I am now using that instead.
 
See:
http://www.oraxcel.com/cgi-bin/yabb2/YaBB.pl?num=1197216176/0
Back to top
 
« Last Edit: 09.12.07 at 17:08:40 by Gerrit-Jan Linker »  

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1