docker-mc-backup icon indicating copy to clipboard operation
docker-mc-backup copied to clipboard

Support for pre/post-backup scripts

Open jcotton42 opened this issue 3 years ago • 2 comments

Implements both methods discussed in #68 through four new environment variables

  • PRE_BACKUP_SCRIPT
  • PRE_BACKUP_SCRIPT_FILE
  • POST_BACKUP_SCRIPT
  • POST_BACKUP_SCRIPT_FILE

The non-*_FILE variables take precedence if both are specified.

Some things I want to address before merging:

  • The pre-backup script runs after auto save has been disabled, and the post-backup script runs after it's been reenabled. Does this seem like the best way to do it?
  • Ideally the post-backup script would still be able to run if the backup failed, to push a failure notification for example. But given the set -e at the script's start the container will exit if the backup fails.
  • On that note, a way for the post-backup script to know how the backup went. Given that they're real scripts an argument would work, but so would an exported environment variable
  • And on that note, in order to not force set -euo pipefail on the scripts I'm not sourcing them, but that also means they can only see exported environment variables. I've added some exports for variables that I think would be useful, but it doesn't feel elegant to do it like that

jcotton42 avatar May 16 '22 02:05 jcotton42

Any updates on this? This feature would be much appreciated!

jacobmichels avatar Aug 25 '22 00:08 jacobmichels

I somehow completely forgot about this PR. My bad.

I should have time to revisit it this weekend @jacobmichels

jcotton42 avatar Aug 25 '22 00:08 jcotton42