DO NOT REPLY [Bug 3787] Optional exit code indicating receiver was changed

samba-bugs at samba.org samba-bugs at samba.org
Tue May 30 20:22:39 GMT 2006


https://bugzilla.samba.org/show_bug.cgi?id=3787


wayned at samba.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




------- Comment #1 from wayned at samba.org  2006-05-30 15:22 MST -------
It seems to me that it would be just as easy to ask rsync to itemize the
changes (see -i) and then filter the output.  For instance:

if rsync -ai /src/ /dest/ | grep '^[<>]f' >/dev/null; then
    echo rsync copied one or more files
else
    echo rsync copied no files
fi

Or, if you need to see the output, substitute something like a perl script for
the grep.  Here's one that runs an rsync command (complete with output) and
sets the return code as appropriate:

#!/usr/bin/perl
open(RSYNC, '-|', 'rsync -ai popt /var/tmp/') or die $!;
while (<RSYNC>) {
    $found = 1 if /^[<>]f/;
    print;
}
close RSYNC;
$status = $? >> 8;
exit($found ? 26 : $status);

Both these options give you full control over what you consider important.  For
instance, the above checks only consider updated files important.  You could
have different exit codes for updated permissions, updated symlinks, or
whatever you need.


-- 
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


More information about the rsync mailing list