diff --git a/scripts/sync b/scripts/sync index b0f2d82..52b2613 100755 --- 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 }