mirror of
https://github.com/lobaro/restic-backup-docker.git
synced 2026-11-22 01:02:39 +00:00
Merge pull request #103 from lobaro/feat/check_after_forget_prune
feat: add restic check after forget with prune
This commit is contained in:
1 file changed
+21
@@ -48,6 +48,8 @@ else
|
|||||||
copyErrorLog
|
copyErrorLog
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
forgetSuccess=false
|
||||||
|
|
||||||
if [[ $backupRC == 0 ]] && [ -n "${RESTIC_FORGET_ARGS}" ]; then
|
if [[ $backupRC == 0 ]] && [ -n "${RESTIC_FORGET_ARGS}" ]; then
|
||||||
echo "Forget about old snapshots based on RESTIC_FORGET_ARGS = ${RESTIC_FORGET_ARGS}"
|
echo "Forget about old snapshots based on RESTIC_FORGET_ARGS = ${RESTIC_FORGET_ARGS}"
|
||||||
restic forget ${RESTIC_FORGET_ARGS} >> ${lastLogfile} 2>&1
|
restic forget ${RESTIC_FORGET_ARGS} >> ${lastLogfile} 2>&1
|
||||||
@@ -55,9 +57,28 @@ if [[ $backupRC == 0 ]] && [ -n "${RESTIC_FORGET_ARGS}" ]; then
|
|||||||
logLast "Finished forget at $(date)"
|
logLast "Finished forget at $(date)"
|
||||||
if [[ $rc == 0 ]]; then
|
if [[ $rc == 0 ]]; then
|
||||||
echo "Forget Successful"
|
echo "Forget Successful"
|
||||||
|
forgetSuccess=true
|
||||||
else
|
else
|
||||||
echo "Forget Failed with Status ${rc}"
|
echo "Forget Failed with Status ${rc}"
|
||||||
restic unlock
|
restic unlock
|
||||||
|
forgetSuccess=false
|
||||||
|
copyErrorLog
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$RESTIC_FORGET_ARGS" | grep -q prune
|
||||||
|
wasPruneRC=$?
|
||||||
|
|
||||||
|
if [ "$forgetSuccess" = true ] && [ $wasPruneRC -eq 0 ]; then
|
||||||
|
echo "Checking repository after forget / prune"
|
||||||
|
restic check >> ${lastLogfile} 2>&1
|
||||||
|
rc=$?
|
||||||
|
logLast "Finished check at $(date)"
|
||||||
|
if [ $rc = 0 ]; then
|
||||||
|
echo "Check Successful"
|
||||||
|
else
|
||||||
|
echo "Check Failed with Status ${rc}"
|
||||||
|
restic unlock
|
||||||
copyErrorLog
|
copyErrorLog
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user