commit 4b7df3b3e6e9d5862bd855ed6feb0841c95d0977 parent 6db048a5db46f580c843a51d41f74ab3aa8371f7 Author: dwrz <dwrz@dwrz.net> Date: Fri, 28 Oct 2022 17:16:24 +0000 Add sync script Diffstat:
A | scripts/sync | | | 17 | +++++++++++++++++ |
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/scripts/sync b/scripts/sync @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +readonly BUCKET="${B2_BUCKET}" + +main() { + # Sync the timelapse. + backblaze-b2 sync \ + --threads 2 \ + "${HOME}/timelapse/" \ + "b2://${BUCKET}/${HOSTNAME}/timelapse/" + + # Delete outdated files. + # This assumes the timelapse is created on an hourly basis. + find "${HOME}/timelapse/" -mmin +60 -delete +} + +main "$@"