Refactor to use rsync server
This commit is contained in:
+5
-6
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user