2019-11-29 11:03:15 -05:00
|
|
|
EXCLUDES=(
|
|
|
|
"/syncthing"
|
|
|
|
"/Movies"
|
|
|
|
".thumbnails"
|
|
|
|
"/Android"
|
|
|
|
"/Download/Images"
|
|
|
|
)
|
|
|
|
RSYNC_COMMAND=(
|
|
|
|
rsync
|
|
|
|
--partial
|
|
|
|
--info=progress2
|
|
|
|
--verbose
|
|
|
|
--no-i-r
|
|
|
|
-a
|
|
|
|
--delete
|
|
|
|
"${EXCLUDES[@]/#/--exclude=}"
|
|
|
|
)
|
2019-03-30 23:37:44 -04:00
|
|
|
SOURCE_LOCATION="/storage/emulated/0/"
|
|
|
|
HOSTNAME="android-phone"
|
|
|
|
REMOTE_HOST="user@example.com"
|
|
|
|
DESTINATION_LOCATION="~/tmp/borg/$HOSTNAME/"
|
|
|
|
BORG_REPO="runner2:borg/$HOSTNAME"
|
2019-11-29 11:03:15 -05:00
|
|
|
BORG_COMMAND=(
|
|
|
|
borg
|
|
|
|
--remote-path borg1
|
|
|
|
--verbose
|
|
|
|
--progress
|
|
|
|
)
|
|
|
|
CREATE_COMMAND=(
|
|
|
|
"${BORG_COMMAND[@]}"
|
|
|
|
create
|
|
|
|
--stats
|
|
|
|
--one-file-system
|
|
|
|
--exclude-caches
|
|
|
|
--compression=auto,lzma
|
|
|
|
)
|
|
|
|
PRUNE_COMMAND=(
|
|
|
|
"${BORG_COMMAND[@]}"
|
|
|
|
prune
|
|
|
|
--list
|
|
|
|
--keep-daily=7
|
|
|
|
--keep-weekly=4
|
|
|
|
--keep-monthly=2
|
|
|
|
)
|
|
|
|
run_remote() {
|
|
|
|
if (( $# == 0 )); then
|
|
|
|
echo "No arguments given to run_remote" >&2
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
ssh "$REMOTE_HOST" -- "cd" "$DESTINATION_LOCATION" "&&" "pwd" "&&" "${@}"
|
|
|
|
}
|