resticprofiles-base/scripts/consul
2023-12-03 02:09:46 -05:00

31 lines
505 B
Bash
Executable file

#!/bin/bash
restoreDir=/etc/restore
consulDir="$restoreDir/consul"
hook_check() {
if [[ -d "$consulDir" ]]; then
rm -rf "$consulDir" || exit 1
fi
}
hook_pre() {
hook_check
mkdir -p "$consulDir" || exit 1
pushd "$restoreDir" || exit 2
consul snapshot save "$consulDir/consul.snap"
popd || exit 2
}
hook_post() {
rm -rf "$consulDir" || exit 1
}
case "$1" in
before_check) hook_check;;
before_backup) hook_pre;;
after_backup) hook_post;;
esac