Refactor to use rsync server

This commit is contained in:
dwrz
2023-05-28 18:28:18 +00:00
parent 7501d00d76
commit 6ef6f554ce
3 changed files with 26 additions and 14 deletions
+5 -6
View File
@@ -1,17 +1,16 @@
#!/usr/bin/env bash
readonly BUCKET="${B2_BUCKET}"
readonly RSYNC_USER="${RSYNC_USER}"
readonly RSYNC_SERVER="${RSYNC_SERVER}"
main() {
local filepath="$1"
local name
name="$(basename "${filepath}")"
backblaze-b2 upload-file \
--threads 2 \
"${BUCKET}" \
"${HOME}/timelapse/${name}" \
"${HOSTNAME}/timelapse/${name}"
rsync --archive --verbose \
"${HOME}/timelapse/${name}" \
"${RSYNC_USER}@${RSYNC_SERVER}:/timelapse/${name}"
# Delete outdated files.
# This assumes the timelapse is created on an hourly basis.