Add commands

This commit is contained in:
Austen Adler 2019-09-15 10:55:36 -04:00
parent 2f990bb643
commit a38b691403
2 changed files with 8 additions and 0 deletions

View File

@ -26,6 +26,10 @@ function time_diff {
printf '%ds\n' $S
}
function prune() {
test -z "$PRUNE_COMMAND" && return
./run_remote.sh cd "$DESTINATION_LOCATION" "&&" $PRUNE_COMMAND "$BORG_REPO"
}
function backup() {
# First, we need to rsync our changes to the host
echo "Running rsync..."
@ -57,6 +61,9 @@ backup
RESULT=$?
DURATION="$(time_diff "$(date +%s)" "$START_TIME" )"
# Prune
prune
echo "Completed $(date +%F-%T)"
echo "Duration: $DURATION"

View File

@ -5,3 +5,4 @@ REMOTE_HOST="user@example.com"
DESTINATION_LOCATION="~/tmp/borg/$HOSTNAME/"
BORG_COMMAND="borg create --verbose --progress --stats --one-file-system --exclude-caches --compression auto,lzma"
BORG_REPO="runner2:borg/$HOSTNAME"
# PRUNE_COMMAND="borg prune -v --list --keep-daily 7 --keep-weekly 4 --keep-monthly 2"