backups: implement maintenance sub command
parent
ad9f9ac72d
commit
b7acc5034d
|
@ -89,8 +89,32 @@ Stopped $backup_stopped
|
||||||
$(cat ~/.restore-info/tmp/backup-log-${script_started}.txt)
|
$(cat ~/.restore-info/tmp/backup-log-${script_started}.txt)
|
||||||
EOMAIL
|
EOMAIL
|
||||||
;;
|
;;
|
||||||
prune)
|
maintenance)
|
||||||
echo "not implemented yet" ;;
|
restic forget -r "$repo" -v --prune \
|
||||||
|
--keep-last 2 --keep-daily 7 --keep-weekly 5 --keep-monthly 6 --keep-yearly 3 \
|
||||||
|
> ~/.restore-info/tmp/maint-forget-log-${script_started}.txt
|
||||||
|
forget_exit_code="$?"
|
||||||
|
|
||||||
|
restic -r "$repo" check --read-data-subset=10% \
|
||||||
|
> ~/.restore-info/tmp/maint-check-log-${script_started}.txt
|
||||||
|
check_exit_code="$?"
|
||||||
|
|
||||||
|
maint_done=$(date +%k%M%S)
|
||||||
|
|
||||||
|
cat <<EOMAIL | msmtp --read-envelope-from $BACKUP_EMAIL_TO
|
||||||
|
To: $BACKUP_EMAIL_TO
|
||||||
|
From: $BACKUP_EMAIL_FROM
|
||||||
|
Subject: Backup maintenance report: $script_started
|
||||||
|
|
||||||
|
- Finished $maint_done
|
||||||
|
- Forgetting exited $forget_exit_code
|
||||||
|
- Checking exiting $check_exit_code
|
||||||
|
|
||||||
|
$(cat ~/.restore-info/tmp/maint-forget-log-${script_started}.txt)
|
||||||
|
|
||||||
|
$(cat ~/.restore-info/tmp/maint-check-log-${script_started}.txt)
|
||||||
|
EOMAIL
|
||||||
|
;;
|
||||||
exec)
|
exec)
|
||||||
shift
|
shift
|
||||||
restic -r "$repo" "$@" ;;
|
restic -r "$repo" "$@" ;;
|
||||||
|
|
Loading…
Reference in New Issue