John Gallagher wrote:
If you want to handle errors from rsync in your shell script,
then remove the "-e" and test for errors after your call to rsync.
Linus
Let me start by saying my shell scripting skills are very weak, as if that
were not already apparent.
I understand the -e will exit when the return code is other than 0. I
believe this is what I want with the exception of the rsync code 24 files
have vanished error. The script is a modified version of one of the
examples found on http://www.mikerubel.org/computers/rsync_snapshots/. It
takes almost 3 hours to complete the index of the directory, sync and then
removal of the oldest backup (Snapshot).
Are you saying that in order to use the wrapper example below I need to
remove the -e? How do I call the wrapper or do I need to incorporate this
example into the original script? This is where I am clueless.....
From: http://samba.anu.edu.au/rsync/FAQ.html
The easiest way to do this is to create a shell script wrapper. For
instance, name this something like "rsync-no24":
#!/bin/sh
rsync "$@"
e=$?
if test $e = 24; then
exit 0
fi
exit $e
First, this is not an rsync issue.
You made this statement in your original post:
<quote>
Any command after the rsync never gets executed if I get the above error.
The file system is very large and we have engineers working at all hours so
it is rare that this would complete with out the code 24 error.
</quote>
That tells me that you want your script (the one you posted in your original
message) to continue processing if rsync takes the error 24. If that is the
case, then you need to remove the -e on your shell invocation OR call a wrapper
that treats the error 24 as normal. Since you seem to be going in the wrapper
direction, leave the -e on you shell invocation (so other errors will cause the
script to exit immediately) and modify this line:
RSYNC="/usr/bin/rsync"
with the path of your wrapper that ignores the error 24. For example:
RSYNC="/usr/local/bin/rsync-no24"
Your wrapper shell script will notice that rsync got an error 24, and return an
exit status of zero so your main shell script will think everything is fine.
Linus
--
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html