Carl’s Blog

Using Rsync to backup SCO OpenServer, Mac OS X, and Windows Server 2003

by Carl Farrington on Jan.13, 2009, under Tips & Tricks

Today I had to knock together a backup solution for a small company who have a very old SCO OpenServer 5.0.5 machine running some bespoke application, a Windows SBS 2003 machine running the usual, and a Mac OS X machine running err, OS X Tiger, all backing up to a USB hard disk on the director’s Windows XP computer.

I decided to use Rsync from the Samba people. It sounded good, but I had a lot of problems along the way with Rsync protocol errors between the SCO box and the XP machine. These problems mostly went away when I changed to using the rsync.exe provided in the Deltacopy package, rather than the one provided in the cwRsync package.

The backup script that I created is found below. It requires Devcon which you can find on Microsoft’s website with the help of Google. The “devcon remove” string at the bottom of the script will probably need the USB\VIDxxxx string changing to reflect that of your USB drive. Check in the details tab of Device Manager on the USB Mass Storage Device to see what the VID ID is. Leave the asterisk (*) at the end in the devcon remove line.

The clever part, in my opinion, of this script is that it will search for the USB hard drive and identify which drive letter has been assigned. Therefore, if the drive is usually assigned G:, but happens to be assigned H: for some reason (incorrect removal of the USB drive leaving a ghost G:  for example), then the script will still work. It does this by looking for a file named drvid.txt on the USB drive, so make sure you create that file on there. I had to make the script call itself in order for the for loop to work on the drvid part. For some reason using “if exist” with a colon, e.g. “if exist f:\drvid.txt” within a for loop is not possible within a batch file, but is possible from the command-line directly. Weird.

You will of course need to have rsync on the Windows machine. I downloaded Deltacopy (after struggling with cwRsync) and simply copied all the files from the Deltacopy directory into c:\windows\system32

What the script doesn’t do is character set conversion from the Mac. This is something I need to look into, as the Mac allows weird filenames, even asterisks in folder names, which of course poses quite a problem.

Also note the drive letter list within the brackets of the for loop. I have intentionally ommited some drive letters, those assigned to network drives and card readers. You will want to populate this properly, perhaps everything from E to Z.

Anyway, here’s the script, or you can download at http://www.css-networks.com/RsyncBackup.cmd

@echo off
SET CYGWIN=nontsec
if %1.==. goto noparams
goto drvid

:noparams
Echo Scanning for external HDD.
devcon rescan
ping localhost -n 30>NUL

for %%a in (g h j k l n o p q u r s t v w x y z) do call %0 %%a

:drvid
if exist %1:\drvid.txt goto found
goto end
:found
Set DRVID=%1
echo Drive found as %DRVID%:
ping localhost -n 30 >NUL
:doeric
Echo.
Echo Rsyncing SCO (Eric) Machine
rsync -avz 192.168.1.2::root /cygdrive/%DRVID%/Eric/
:doserver
echo.
Echo Rsyncing Windows Server Data
rsync -azv “192.168.1.1::Network Shares” /cygdrive/%DRVID%/Server
:dosimon
echo.
Echo Rsyncing Simon’s Data
rsync -azv “192.168.1.11::documents” /cygdrive/%DRVID%/Mac/Documents
rsync -azv “192.168.1.11::250gb” /cygdrive/%DRVID%/Mac/250gb
:remove hdd
Echo.
Echo Peparing external HDD for removal
devcon remove USB\VID_152D*
ping localhost -n 30>NUL
pause
:end


2 Comments for this entry

  • Wardp

    Hi there,

    I am looking at doing the same thing (I think).
    My first problem is getting rsync to woork on a 5.0.6 system.
    - where did you find an install package?
    - what prerequisits did you need?

    Thanks in advance!
    Ward

  • Carl Farrington

    Hi Ward. I built from source, which surprised me quite a bit. I was expecting there to be no C compiler or libraries on there, but with the exception of one or two dependancies (I think.. it was over a month ago now), it built perfectly.

    I think I built from source anyway. Am I being vague enough? Sorry ;)
    I’ll take a look on the machine when I get a minute and see.. it might be that I found a binary on t’internet somewhere in the end. I definately remember downloading source, it’s just whether I was successful in building or not..

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...