RE: Shell Script Does not complete if rsync returns Code 24
> First, this is not an rsync issue. > > 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 You are correct this is not a rsync issue, however the FAQ is posted on how to filter out the Code 24 error. What was not clear to me was how to call the no24 wrapper. It is very clear now and I have modified the script based on your recommendations. Thank you! John -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: Shell Script Does not complete if rsync returns Code 24
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: 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: 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
RE: Shell Script Does not complete if rsync returns Code 24
> The FAQ says to name the script something like rsync-no24. > All you'd need to do in your script is to run rsync-no24 in > place of rsync. > > ..wayne.. Thanks for the clarification, I can do that! John -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: Shell Script Does not complete if rsync returns Code 24
On Tue, Jan 10, 2006 at 07:28:00PM -0800, John Gallagher wrote: > The problem is that I have no clue what to do with this and or how to > make it work with my script. The FAQ says to name the script something like rsync-no24. All you'd need to do in your script is to run rsync-no24 in place of rsync. ..wayne.. -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
RE: Shell Script Does not complete if rsync returns Code 24
> 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 Thanks, John -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: Shell Script Does not complete if rsync returns Code 24
René Rebe wrote: Hi, On Wednesday 11 January 2006 04:28, John Gallagher wrote: The problem is that I have no clue what to do with this and or how to make it work with my script. If you want hide errors, remove the -e from your sh invocation or add || true at the end of the rsync invocation. Though I would not do either in a backup script. Better would be to just ignore some of rsync's return codes. It seems to me you are getting what you are asking for. From the sh manpage: -e Exit immediately if a simple command (see SHELL GRAMMAR above) exits with a non-zero status. The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of a && or || list, or if the command's return value is being inverted via !. A trap on ERR, if set, is executed before the shell exits. 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 -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: Shell Script Does not complete if rsync returns Code 24
Hi, On Wednesday 11 January 2006 04:28, John Gallagher wrote: > The problem is that I have no clue what to do with this and or how to make > it work with my script. If you want hide errors, remove the -e from your sh invocation or add || true at the end of the rsync invocation. Though I would not do either in a backup script. Better would be to just ignore some of rsync's return codes. Regards, -- René Rebe - Rubensstr. 64 - 12157 Berlin (Europe / Germany) http://www.exactcode.de | http://www.t2-project.org +49 (0)30 255 897 45 -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html