samba-bugs@samba.org
2006-May-18 21:07 UTC
DO NOT REPLY [Bug 3787] New: Optional exit code indicating receiver was changed
https://bugzilla.samba.org/show_bug.cgi?id=3787
Summary: Optional exit code indicating receiver was changed
Product: rsync
Version: 2.6.9
Platform: Other
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: core
AssignedTo: wayned@samba.org
ReportedBy: hashproduct+rsync@gmail.com
QAContact: rsync-qa@samba.org
I'd like an option that causes rsync to exit with a distinctive exit code,
say
26, if everything is successful and one or more files on the receiver were
changed (or would have been changed if --dry-run had not been used). If
nothing on the receiver was changed, rsync should exit 0.
If rsync had this option, makefiles could implement better dependency logic for
commands that operate on large file trees by using rsync to detect whether a
file tree has changed. Specifically, my Web site's build system calls rsync
once to collect the files to be posted into a temporary folder and again to
push the temporary folder to the server I'm using. I'd like to skip the
second
rsync if the first rsync does not modify the temporary folder.
--
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.
samba-bugs@samba.org
2006-May-30 20:22 UTC
DO NOT REPLY [Bug 3787] Optional exit code indicating receiver was changed
https://bugzilla.samba.org/show_bug.cgi?id=3787
wayned@samba.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX
------- Comment #1 from wayned@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.
Maybe Matching Threads
- DO NOT REPLY [Bug 4080] New: rsync can't find basis dirs with -n and nonexistent destination
- DO NOT REPLY [Bug 4138] New: Incoming chmod can't override inherited directory setgid
- DO NOT REPLY [Bug 4985] New: --list-only shows implied dirs even with --no-implied-dirs
- DO NOT REPLY [Bug 3825] New: rsync won't delete directory with excluded files
- DO NOT REPLY [Bug 4056] New: Option to look for fuzzy basis files in --*-dest directories