Refactor sync script
This commit is contained in:
+5
-4
@@ -3,14 +3,15 @@
|
|||||||
readonly BUCKET="${B2_BUCKET}"
|
readonly BUCKET="${B2_BUCKET}"
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# Sync the timelapse.
|
backblaze-b2 upload-file \
|
||||||
backblaze-b2 sync \
|
|
||||||
--threads 2 \
|
--threads 2 \
|
||||||
"${HOME}/timelapse/" \
|
"${BUCKET}" \
|
||||||
"b2://${BUCKET}/${HOSTNAME}/timelapse/"
|
"${PROJECT}/motion/${name}.jpg" \
|
||||||
|
"${HOSTNAME}/timelapse/$1"
|
||||||
|
|
||||||
# Delete outdated files.
|
# Delete outdated files.
|
||||||
# This assumes the timelapse is created on an hourly basis.
|
# This assumes the timelapse is created on an hourly basis.
|
||||||
|
rm -f "$1"
|
||||||
find "${HOME}/timelapse/" -mmin +60 -delete
|
find "${HOME}/timelapse/" -mmin +60 -delete
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user