Refactor scripts
This commit is contained in:
@@ -78,7 +78,6 @@ delete_outdated() {
|
|||||||
rm -f "$1"
|
rm -f "$1"
|
||||||
rm -f "${PROJECT}/motion/${name}.jpg"
|
rm -f "${PROJECT}/motion/${name}.jpg"
|
||||||
find "${HOME}/photo/" -mmin +5 -delete
|
find "${HOME}/photo/" -mmin +5 -delete
|
||||||
find "${HOME}/timelapse/" -mmin +60 -delete
|
|
||||||
find "${PROJECT}/motion/" -iname "*.jpg" -mmin +5 -delete
|
find "${PROJECT}/motion/" -iname "*.jpg" -mmin +5 -delete
|
||||||
find "${PROJECT}/motion/labels/" -mmin +5 -delete
|
find "${PROJECT}/motion/labels/" -mmin +5 -delete
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -3,11 +3,15 @@
|
|||||||
readonly BUCKET="${B2_BUCKET}"
|
readonly BUCKET="${B2_BUCKET}"
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
local filepath="$1"
|
||||||
|
local name
|
||||||
|
name="$(basename "${filepath}")"
|
||||||
|
|
||||||
backblaze-b2 upload-file \
|
backblaze-b2 upload-file \
|
||||||
--threads 2 \
|
--threads 2 \
|
||||||
"${BUCKET}" \
|
"${BUCKET}" \
|
||||||
"${PROJECT}/motion/${name}.jpg" \
|
"${HOME}/timelapse/${name}" \
|
||||||
"${HOSTNAME}/timelapse/$1"
|
"${HOSTNAME}/timelapse/${name}"
|
||||||
|
|
||||||
# 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user