News for hackers. Stuff that matters.
Re:An almost perfect rsync over SSH backup script by koolba on Friday February 25, 2022 @10:26AM (#30468237)
Using -e isn't an excuse to not understand how it works and when it doesn't. It's so that the default in most situation is to exit on failure as that's likely what you want to do. That leads to more terse scripts which hopefully are easier to write correctly and understand. I'd argue that opting in to exit-on-failure for stand alone commands is the right default.
Re:An almost perfect rsync over SSH backup script by eurasiantiger on Friday February 25, 2022 @05:33PM (#30473174)
No, absolutely wrong. The ”right default” is to catch return codes and provide actionable, clear and consistent error messages through an error-exit function.
Re:An almost perfect rsync over SSH backup script by longcommonname on Saturday February 26, 2022 @12:45AM (#30475454)
If I'm writing a bash script I run manually and it's more than a handful of functions I agree. I'm there to babysit it and its probably complicated.

If the bash script is ran on thousands of containers where its not possible to babysit. My number one job is to stop immediately when an error happens and surface that error to any monitoring system.

Re:An almost perfect rsync over SSH backup script by eurasiantiger on Saturday February 26, 2022 @10:12AM (#30478139)
I agree about that distinction, but still, won’t that error need to be formatted? Is it safe to rely on logging picking up on the error or does the ”simple script” solution imply that there is monitoring for the script exit code?