btrfs-snap
btrfs-snap copied to clipboard
prevent exit code 1 when deleting a snapshot in quiet mode (-q)
When in quiet mode (i.e., -q
is given) false negative exit codes might occur.
For example, when snapshots have to be deleted due to rotation.
This is especially annoying with (various) cron (implementations), because non-zero exit codes trigger an email being sent although no actual error occurred.
The cause might be the line test -z "$quiet" && echo "$1"
in function log.info()
(e.g., in 1.7.3: https://github.com/jf647/btrfs-snap/blob/7126515e2259c24b29a2a8ba272e7917db5a703c/btrfs-snap#L183-L186) which does not "mask" negative exit codes of test
.
Since this repository does not seem to be maintained by @jf647 anymore, I meanwhile merged this into https://github.com/lpirl/btrfs-snap/tree/master .
I agree with problem description as well as solution.