Shell Script Does not complete if rsync returns Code 24

Linus Hicks lihicks at gpi.com
Wed Jan 11 14:02:16 GMT 2006


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


More information about the rsync mailing list