Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect backup failure in POST_BACKUP_SCRIPT #135

Open
Fysac opened this issue Apr 8, 2023 · 3 comments
Open

Detect backup failure in POST_BACKUP_SCRIPT #135

Fysac opened this issue Apr 8, 2023 · 3 comments

Comments

@Fysac
Copy link

Fysac commented Apr 8, 2023

It would be nice for POST_BACKUP_SCRIPT to be able to detect when a backup failed, so that it can send out a notification in case of an error (e.g., an unhandled restic state). This was one of the use cases for the feature originally described in #89, but I don't see any way for a post-backup script to currently tell if something went awry.

I think all this would take is passing the exit code (and possibly some stderr output?) from the backup stage as an argument to the script on this line:

"$POST_BACKUP_SCRIPT_FILE"

@itzg
Copy link
Owner

itzg commented Apr 9, 2023

@jcotton42 can you confirm this was absent from your PR. Since you mentioned the use case, it seems like you have included it.

@jcotton42
Copy link
Contributor

It was something I meant to address, but never got around to doing so. Passing the exit code would likely suffice, though I think the set -e at the start of backup-loop.sh might have to be removed? Or at least disabled for the line that runs the backup. Since iirc that makes bash bail on the first command that dies.

@itzg
Copy link
Owner

itzg commented Apr 9, 2023

Cool. Just wanted to check. I believe putting the invocation in a conditional should satisfy the -e constraint.

@Fysac if you're interested in PR'ing this, then that would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

3 participants