diff --git a/scripts/notify b/scripts/notify index b058891..6d66acb 100755 --- a/scripts/notify +++ b/scripts/notify @@ -1,8 +1,5 @@ #!/usr/bin/env bash -# Backblaze B2 Bucket -readonly BUCKET="${B2_BUCKET}" - # Devices to check -- if populated and up, no notifications are sent. readonly DEVICES=() @@ -19,6 +16,10 @@ readonly PROJECT="/tmp/yolov7" # Notification recipient. readonly RECIPIENT="${NOTIFICATION_RECIPIENT}" +# rsync user and server for backups. +readonly RSYNC_USER="${RSYNC_USER}" +readonly RSYNC_SERVER="${RSYNC_SERVER}" + acquire_lock () { while true; do if mkdir "${LOCKFILE}"; then @@ -63,11 +64,9 @@ notify() { upload() { local name="$1" - backblaze-b2 upload-file \ - --threads 2 \ - "${BUCKET}" \ - "${PROJECT}/motion/${name}.jpg" \ - "${HOSTNAME}/photo/${name}.jpg" + rsync --archive --verbose \ + "${PROJECT}/motion/${name}.jpg" \ + "${RSYNC_USER}@${RSYNC_SERVER}:/photo/${name}.jpg" } delete_outdated() { diff --git a/scripts/sync b/scripts/sync index 5d9b258..52f58ec 100755 --- a/scripts/sync +++ b/scripts/sync @@ -1,17 +1,16 @@ #!/usr/bin/env bash -readonly BUCKET="${B2_BUCKET}" +readonly RSYNC_USER="${RSYNC_USER}" +readonly RSYNC_SERVER="${RSYNC_SERVER}" main() { local filepath="$1" local name name="$(basename "${filepath}")" - backblaze-b2 upload-file \ - --threads 2 \ - "${BUCKET}" \ - "${HOME}/timelapse/${name}" \ - "${HOSTNAME}/timelapse/${name}" + rsync --archive --verbose \ + "${HOME}/timelapse/${name}" \ + "${RSYNC_USER}@${RSYNC_SERVER}:/timelapse/${name}" # Delete outdated files. # This assumes the timelapse is created on an hourly basis. diff --git a/setup b/setup index 2259180..8a69b5f 100755 --- a/setup +++ b/setup @@ -21,6 +21,8 @@ MOTION_LOG_FILE="/var/log/motion/motion.log" MOTION_PASSWORD="$(tr -dc A-Za-z0-9