Pruning attempts continue; snapshot logging fix
This commit is contained in:
16
Kumonoboru
16
Kumonoboru
@@ -89,7 +89,7 @@ backup(){
|
||||
if safety "$REPOSITORY"; then
|
||||
#Run the backup
|
||||
info "Backing up repository $REPOSITORY"
|
||||
if restic -r b2:"$REPOSITORY" backup "$REPOSITORY_PATH" --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT"; then
|
||||
if restic -r b2:"$REPOSITORY" backup "$REPOSITORY_PATH" --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT" | tee -a $LOG; then
|
||||
ok "Path $REPOSITORY_PATH completed upload to $REPOSITORY."
|
||||
check "$REPOSITORY"
|
||||
else
|
||||
@@ -100,6 +100,7 @@ backup(){
|
||||
check(){
|
||||
REPOSITORY="$1"
|
||||
PRUNE="$2"
|
||||
debug "Working on Repostory $1 with prune option $2"
|
||||
## ^ This variable will have value if repo is already clean, indicating
|
||||
#+ This is a post backup check.
|
||||
if [[ -n $PRUNE ]]; then
|
||||
@@ -107,13 +108,12 @@ check(){
|
||||
fi
|
||||
if safety "$REPOSITORY"; then
|
||||
info "Checking repository $REPOSITORY"
|
||||
if restic -r b2:"$REPOSITORY" check --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT"; then
|
||||
if restic -r b2:"$REPOSITORY" check --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT" | tee -a $LOG; then
|
||||
ok "Repository $REPOSITORY passed integrity check!"
|
||||
info "Current snapshots:"
|
||||
restic -r b2:"$REPOSITORY" snapshots >> $LOG
|
||||
if [[ -z $PRUNE ]] && [[ $(date +%d) == "18" ]]; then
|
||||
#Only clean the repository if ^not done already ^ and today is the 18th of the month (prune monthly)
|
||||
info "Monthly prune is today; cleaning $REPOSITORY"
|
||||
restic -r b2:"$REPOSITORY" snapshots | tee -a $LOG
|
||||
if [[ -n $PRUNE ]]; then
|
||||
info "prune is called for; cleaning $REPOSITORY"
|
||||
clean "$REPOSITORY"
|
||||
fi
|
||||
else
|
||||
@@ -125,7 +125,7 @@ clean(){
|
||||
REPOSITORY="$1"
|
||||
if safety "$REPOSITORY"; then
|
||||
info "Cleaning repository $REPOSITORY"
|
||||
if restic -r b2:$REPOSITORY forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT"; then
|
||||
if restic -r b2:$REPOSITORY forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT" | tee -a $LOG; then
|
||||
ok "Repository $REPOSITORY is trim!"
|
||||
debug "Running post clean check..."
|
||||
check "$REPOSITORY" "1"
|
||||
@@ -171,7 +171,7 @@ elif [[ -n $REPOSITORY ]] && [[ -n $CLEAN ]]; then
|
||||
help;;
|
||||
esac
|
||||
#If cleaning was forced and no repository specified, clean all repositories
|
||||
elif [[ -n $CLEAN ]]; then
|
||||
elif [[ -n $CLEAN ]] || [[ $(date +%a) == "Friday" ]]; then
|
||||
clean Gerbil-TK
|
||||
clean Pukeko-XYZ-Containers
|
||||
clean Pukeko-XYZ-Cloud
|
||||
|
||||
Reference in New Issue
Block a user