Shell Script Does not complete if rsync returns Code 24
lihicks at gpi.com
Wed Jan 11 18:36:06 GMT 2006
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.
> 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":
> rsync "$@"
> if test $e = 24; then
> exit 0
> exit $e
First, this is not an rsync issue.
You made this statement in your original post:
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.
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:
with the path of your wrapper that ignores the error 24. For example:
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.
More information about the rsync