LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   rsync running within bash scripts exits the script after fininishing (https://www.linuxquestions.org/questions/linux-software-2/rsync-running-within-bash-scripts-exits-the-script-after-fininishing-4175735409/)

i1mw3b 03-28-2024 10:39 AM

rsync running within bash scripts exits the script after fininishing
 
I have a bash script doing incremental (link-dest) rsync backups for my home directory.
One file is owned by root and rsync gives this message, then continues:

rsync: [sender] send_files failed to open "/home/jww/src/kkll": Permission denied (13)

Then when the rsync command is complete, it spits out this message. Then continues with it's summary
message, e.g. total size is ....

rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]

Then the script exits. Now, I understand the errors. The file kkll is owned by root and user has no read permission, which I fixed.

I am very curious tho, why rsync would continue to finish and just exit, instead returning a return code.

Love rsync however. Written by some very smart folks.

Thanks,

Jimmy

wpeckham 04-02-2024 01:32 PM

I hope you realize that without sharing the script so we can read your logic and see how you trapped (or did not trap) the return code (I hope you read the rsync man page to identify the return codes it issues) it is difficult for us to evaluate your question, much less answer it.

i1mw3b 04-05-2024 09:18 AM

Solved. My stupidity.
Your comment to include my script caused me to create a very small script to illustrate and it worked. Then realized I had a "set -eo pipefail" in my script. Must've cut and pasted from somewhere.

Thanks,

wpeckham 04-05-2024 10:40 AM

Glad you found that!
Best of luck!


All times are GMT -5. The time now is 06:46 PM.