commit 03dc893051d8ed423ae68025fa8fa7ddcc5bfeb3 parent 680a0d8ec49879bf942ac2cc519bbb21018cf756 Author: dwrz <dwrz@dwrz.net> Date: Wed, 1 Feb 2023 19:51:01 +0000 Refactor sync script Diffstat:
M | scripts/sync | | | 11 | ++++++----- |
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/scripts/sync b/scripts/sync @@ -3,14 +3,15 @@ readonly BUCKET="${B2_BUCKET}" main() { - # Sync the timelapse. - backblaze-b2 sync \ - --threads 2 \ - "${HOME}/timelapse/" \ - "b2://${BUCKET}/${HOSTNAME}/timelapse/" + backblaze-b2 upload-file \ + --threads 2 \ + "${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 }