Refactor sync script

This commit is contained in:
dwrz
2023-02-01 19:51:01 +00:00
parent 680a0d8ec4
commit 03dc893051
+5 -4
View File
@@ -3,14 +3,15 @@
readonly BUCKET="${B2_BUCKET}"
main() {
# Sync the timelapse.
backblaze-b2 sync \
backblaze-b2 upload-file \
--threads 2 \
"${HOME}/timelapse/" \
"b2://${BUCKET}/${HOSTNAME}/timelapse/"
"${BUCKET}" \
"${PROJECT}/motion/${name}.jpg" \
"${HOSTNAME}/timelapse/$1"
# Delete outdated files.
# This assumes the timelapse is created on an hourly basis.
rm -f "$1"
find "${HOME}/timelapse/" -mmin +60 -delete
}