Compare commits
2 Commits
a7d559740a
...
0e1d2fc993
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e1d2fc993 | |||
| ae8dc0edd0 |
16
Kumonoboru
16
Kumonoboru
@@ -89,7 +89,7 @@ backup(){
|
|||||||
if safety "$REPOSITORY"; then
|
if safety "$REPOSITORY"; then
|
||||||
#Run the backup
|
#Run the backup
|
||||||
info "Backing up repository $REPOSITORY"
|
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."
|
ok "Path $REPOSITORY_PATH completed upload to $REPOSITORY."
|
||||||
check "$REPOSITORY"
|
check "$REPOSITORY"
|
||||||
else
|
else
|
||||||
@@ -100,6 +100,7 @@ backup(){
|
|||||||
check(){
|
check(){
|
||||||
REPOSITORY="$1"
|
REPOSITORY="$1"
|
||||||
PRUNE="$2"
|
PRUNE="$2"
|
||||||
|
debug "Working on Repostory $1 with prune option $2"
|
||||||
## ^ This variable will have value if repo is already clean, indicating
|
## ^ This variable will have value if repo is already clean, indicating
|
||||||
#+ This is a post backup check.
|
#+ This is a post backup check.
|
||||||
if [[ -n $PRUNE ]]; then
|
if [[ -n $PRUNE ]]; then
|
||||||
@@ -107,15 +108,10 @@ check(){
|
|||||||
fi
|
fi
|
||||||
if safety "$REPOSITORY"; then
|
if safety "$REPOSITORY"; then
|
||||||
info "Checking repository $REPOSITORY"
|
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!"
|
ok "Repository $REPOSITORY passed integrity check!"
|
||||||
info "Current snapshots:"
|
info "Current snapshots:"
|
||||||
restic -r b2:"$REPOSITORY" snapshots >> $LOG
|
restic -r b2:"$REPOSITORY" snapshots | tee -a $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"
|
|
||||||
clean "$REPOSITORY"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
error "Repository $REPOSITORY failed integrity check!"
|
error "Repository $REPOSITORY failed integrity check!"
|
||||||
fi
|
fi
|
||||||
@@ -125,7 +121,7 @@ clean(){
|
|||||||
REPOSITORY="$1"
|
REPOSITORY="$1"
|
||||||
if safety "$REPOSITORY"; then
|
if safety "$REPOSITORY"; then
|
||||||
info "Cleaning repository $REPOSITORY"
|
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!"
|
ok "Repository $REPOSITORY is trim!"
|
||||||
debug "Running post clean check..."
|
debug "Running post clean check..."
|
||||||
check "$REPOSITORY" "1"
|
check "$REPOSITORY" "1"
|
||||||
@@ -171,7 +167,7 @@ elif [[ -n $REPOSITORY ]] && [[ -n $CLEAN ]]; then
|
|||||||
help;;
|
help;;
|
||||||
esac
|
esac
|
||||||
#If cleaning was forced and no repository specified, clean all repositories
|
#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 Gerbil-TK
|
||||||
clean Pukeko-XYZ-Containers
|
clean Pukeko-XYZ-Containers
|
||||||
clean Pukeko-XYZ-Cloud
|
clean Pukeko-XYZ-Cloud
|
||||||
|
|||||||
Reference in New Issue
Block a user