Check absolutely slaughter download bandwidth; run them once mothly. Relegated logging to systemd
This commit is contained in:
15
Kumonoboru
15
Kumonoboru
@@ -66,7 +66,6 @@ flags()
|
|||||||
}
|
}
|
||||||
flags "$@"
|
flags "$@"
|
||||||
source /home/shmick/Scripts/Okiru "$VERBOSE"
|
source /home/shmick/Scripts/Okiru "$VERBOSE"
|
||||||
logging Kumonoboru
|
|
||||||
#Defaults
|
#Defaults
|
||||||
if [[ -z $BWLIMIT ]]; then
|
if [[ -z $BWLIMIT ]]; then
|
||||||
export BWLIMIT="0"
|
export BWLIMIT="0"
|
||||||
@@ -101,9 +100,8 @@ 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 --cache-dir="$RESTIC_CACHE_DIR" -r b2:"$REPOSITORY" backup "$REPOSITORY_PATH" --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT" | tee -a $LOG; then
|
if restic --cache-dir="$RESTIC_CACHE_DIR" -r b2:"$REPOSITORY" backup "$REPOSITORY_PATH" --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT"; then
|
||||||
ok "$REPOSITORY_PATH" "completed upload to $REPOSITORY."
|
ok "$REPOSITORY_PATH" "completed upload to $REPOSITORY."
|
||||||
check "$REPOSITORY"
|
|
||||||
else
|
else
|
||||||
error "$REPOSITORY failed to upload path" "$REPOSITORY_PATH"
|
error "$REPOSITORY failed to upload path" "$REPOSITORY_PATH"
|
||||||
fi
|
fi
|
||||||
@@ -120,7 +118,7 @@ check(){
|
|||||||
fi
|
fi
|
||||||
if safety "$REPOSITORY"; then
|
if safety "$REPOSITORY"; then
|
||||||
info "Checking repository health - " "$REPOSITORY"
|
info "Checking repository health - " "$REPOSITORY"
|
||||||
if restic -r b2:"$REPOSITORY" check --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT" | tee -a $LOG; then
|
if restic -r b2:"$REPOSITORY" check --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT"; then
|
||||||
ok "Repository passed integrity check - " "$REPOSITORY"
|
ok "Repository passed integrity check - " "$REPOSITORY"
|
||||||
info "Current snapshots:"
|
info "Current snapshots:"
|
||||||
restic -r b2:"$REPOSITORY" snapshots | tee -a $LOG
|
restic -r b2:"$REPOSITORY" snapshots | tee -a $LOG
|
||||||
@@ -133,7 +131,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" | tee -a $LOG; then
|
if restic -r b2:$REPOSITORY forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT"; then
|
||||||
ok "Repository is trim - " "$REPOSITORY"
|
ok "Repository is trim - " "$REPOSITORY"
|
||||||
debug "Running post clean check..."
|
debug "Running post clean check..."
|
||||||
check "$REPOSITORY" "1"
|
check "$REPOSITORY" "1"
|
||||||
@@ -167,12 +165,15 @@ elif [[ -z $CLEAN ]]; then
|
|||||||
elif [[ -n $REPOSITORY ]] && [[ -n $CLEAN ]]; then
|
elif [[ -n $REPOSITORY ]] && [[ -n $CLEAN ]]; then
|
||||||
case "$REPOSITORY" in
|
case "$REPOSITORY" in
|
||||||
(Gerbil-TK)
|
(Gerbil-TK)
|
||||||
|
check Gerbil-TK
|
||||||
clean Gerbil-TK
|
clean Gerbil-TK
|
||||||
;;
|
;;
|
||||||
(Pukeko-XYZ-Containers)
|
(Pukeko-XYZ-Containers)
|
||||||
|
check Pukeko-XYZ-Containers
|
||||||
clean Pukeko-XYZ-Containers
|
clean Pukeko-XYZ-Containers
|
||||||
;;
|
;;
|
||||||
(Pukeko-XYZ-Cloud)
|
(Pukeko-XYZ-Cloud)
|
||||||
|
check Pukeko-XYZ-Cloud
|
||||||
clean Pukeko-XYZ-Cloud
|
clean Pukeko-XYZ-Cloud
|
||||||
;;
|
;;
|
||||||
(*)
|
(*)
|
||||||
@@ -180,11 +181,13 @@ elif [[ -n $REPOSITORY ]] && [[ -n $CLEAN ]]; then
|
|||||||
esac
|
esac
|
||||||
#If cleaning was forced, or if it's the first of this month - clean.
|
#If cleaning was forced, or if it's the first of this month - clean.
|
||||||
elif [[ -n $CLEAN ]] || [[ $(date +%d) == "1" ]]; then
|
elif [[ -n $CLEAN ]] || [[ $(date +%d) == "1" ]]; then
|
||||||
|
check Gerbil-TK
|
||||||
clean Gerbil-TK
|
clean Gerbil-TK
|
||||||
|
check Pukeko-XYZ-Containers
|
||||||
clean Pukeko-XYZ-Containers
|
clean Pukeko-XYZ-Containers
|
||||||
|
check Pukeko-XYZ-Cloud
|
||||||
clean Pukeko-XYZ-Cloud
|
clean Pukeko-XYZ-Cloud
|
||||||
fi
|
fi
|
||||||
#Wrap up this run's log and report nicely
|
#Wrap up this run's log and report nicely
|
||||||
echo "All done; have a nice day!"
|
echo "All done; have a nice day!"
|
||||||
end_logging
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user