[Gllug] Verifying rsync copy

Jon Dye jon at pecorous.co.uk
Wed May 13 12:28:46 UTC 2009


2009/5/13 John Hearns <hearnsj at googlemail.com>:
> 2009/5/13 Jon Dye <jon at pecorous.co.uk>:
>> I use rsync to copy a directory of files to a remote location from a
>> cron job once a day.  Currently I give it the --verbose option so in
>> my email from cron I can see that it's actually worked (normally it's
>> silent).  I'd rather just have my cron email tell me if it transfered
>> anything and/or that the remote and local directories have the same
>> contents.
>
> You could look at the exit code from rsync, would that help?

Not sure.  Do people rely on the exit code from their backup to verify
that the backup worked or do they run a subsequent verify?  That's
kind of the position i'm in and I decided I wasn't happy with just the
copy.  Maybe I should satisfy myself with just the exit code from the
copy.

> I guess though that you are not asking this question - you want to
> know if both directory trees have the same contents.

In theory if rsync runs successfully then they should have, so a
success exit code should tell me that right?

> You could write a script to md5sun each file and compare it with the
> md5sum on the original server - but that's what rsync does.
> How about running rsync for a second time, with the "-n" flag and
> checking the output status?
> Seems a bit futile really to run it again though - just check the exit
> code from the original rsync.

Yeah, maybe it's overkill to do a later verification step.

JD
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list