[sclug] Spotting errors in a scheduled rsync job

ed ed at s5h.net
Fri Jun 8 22:09:41 UTC 2007

On Fri, 8 Jun 2007 16:22:54 +0100
Tom Chance <tom at acrewoods.net> wrote:

> I'm using rsync (via Cygwin on a Win2k3 server) to backup data from a
> server at work to a network attached storage device. It's a nice,
> simple solution and I've got it running every night without any
> problems.
> However, I want to make it easy to spot problems. The main ones I can
> think of are rsync just completely failing to run, getting halfway
> through a job and for some reason aborting, or not finding the
> destination folder. I don't want to have to dig through the output
> every day to spot problems. I also want it to be easy so my
> non-technical colleagues can spot issues when I'm on holiday.
> Another scheduled task I have is just an scp operation to grab some
> remote data on a daily basis (a web site backup), and it's really
> simple to just email the results to a specified addrress if it works.
> Does anyone know of any recipes or utilities to do this? I've had a
> bit of a dig around on the internet but so far I've come up blank.

Nice to see someone else using roundcube, have they fixed that damn 5
minute default time out? :-)

Anyway. If you're using win32, perhaps rsync will exit with non-0 when
there's a problem:

rsync  -azv source destination --delete
if %ERRORLEVEL% != 0 

(excuse me my .bat is very rusty)

Windows and Unix-like have std redirects, so capturing errors should be
easily done like this:

rsync  -azv source destination --delete > nul 2>error_log.txt

But, I think it's worth calling rsync with --ignore-errors then the
rest of the backup cycle can finish and you still get your error log,
but you must make a plan to check the logs!

The bread crumbs to the bathroom is losing cohesion because of Shagy
downloading MP3's. CrossPoint Ventures is working on retention of high
performance employees. :: http://www.s5h.net/ :: http://www.s5h.net/gpg

More information about the Sclug mailing list