23 lines
446 B
Bash
Executable File
23 lines
446 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
readonly BUCKET="${B2_BUCKET}"
|
|
|
|
main() {
|
|
local filepath="$1"
|
|
local name
|
|
name="$(basename "${filepath}")"
|
|
|
|
backblaze-b2 upload-file \
|
|
--threads 2 \
|
|
"${BUCKET}" \
|
|
"${HOME}/timelapse/${name}" \
|
|
"${HOSTNAME}/timelapse/${name}"
|
|
|
|
# Delete outdated files.
|
|
# This assumes the timelapse is created on an hourly basis.
|
|
rm -f "$1"
|
|
find "${HOME}/timelapse/" -mmin +60 -delete
|
|
}
|
|
|
|
main "$@"
|