Error handling with rsync

Martin Pool mbp at samba.org
Thu Apr 18 19:24:02 EST 2002


On 18 Apr 2002, Otto Wyss <otto.wyss at bluewin.ch> wrote:
> Since I uses rsync in a perl script I'd rather prefer to get error codes from
> rsync instead of messages at STDOUT. Is there an option which tells rsync it
> should return error codes?

You ought to get an exit code which indicates what happened overall;
see the manual or errcode.h for the possible values.  Of course you 
only get one error code for the whole operation.

I'd like to add an option which makes rsync produce machine-parseable
output on stdout, so that programs can interpret it as they wish.
At the moment it's likely to be SMTP-like in format (but of course
unidirectional from rsync out):

e.g.

RSYNC 2.5.6
START-CONNECT TCP jonquille.ozlabs.hp.com 8733
COMPLETE-CONNECT
SELECT-MODULE images
START-READ-FILELIST
COMPLETE-READ-FILELIST 388 files 1237918237 bytes
START-RECIEVE-FILE install_2.4.5_beta.tgz O
FILE-SIZE  23223983 bytes
FILE-MTIME 91823923832 unix
PROGRESS 100000
PROGRESS 200000

etc

Comments welcome.

> Is this possible or do I ask something ridiculous? How is the error handling
> done when rsync can't download a file?

What do you mean?

> Should I better switch to the rsync library, is there a perl interface?

It can't talk to rsync servers (yet).  It's probably not suitable for 
your purposes.

--
Martin




More information about the rsync mailing list