mirror of
https://github.com/cimryan/teslausb.git
synced 2026-02-28 20:20:32 +00:00
Merge pull request #65 from rtanaka/rclone_archive
add support for cloud based syncing (e.g. Google Drive) via rclone
This commit is contained in:
20
run/rclone_archive/archive-clips.sh
Normal file
20
run/rclone_archive/archive-clips.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
log "Moving clips to rclone archive..."
|
||||
|
||||
source /root/.teslaCamRcloneConfig
|
||||
|
||||
NUM_FILES_MOVED=0
|
||||
|
||||
for file_name in "$CAM_MOUNT"/TeslaCam/saved*; do
|
||||
[ -e "$file_name" ] || continue
|
||||
log "Moving $file_name ..."
|
||||
rclone --config /root/.config/rclone/rclone.conf move "$file_name" "$drive:$path" >> "$LOG_FILE" 2>&1 || echo ""
|
||||
log "Moved $file_name."
|
||||
NUM_FILES_MOVED=$((NUM_FILES_MOVED + 1))
|
||||
done
|
||||
log "Moved $NUM_FILES_MOVED file(s)."
|
||||
|
||||
/root/bin/send-pushover "$NUM_FILES_MOVED"
|
||||
|
||||
log "Finished moving clips to rclone archive"
|
||||
10
run/rclone_archive/configure-archive.sh
Normal file
10
run/rclone_archive/configure-archive.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
function configure_archive () {
|
||||
echo "Configuring the archive for Rclone..."
|
||||
|
||||
echo "drive=$RCLONE_DRIVE" > /root/.teslaCamRcloneConfig
|
||||
echo "path=$RCLONE_PATH" >> /root/.teslaCamRcloneConfig
|
||||
}
|
||||
|
||||
configure_archive
|
||||
2
run/rclone_archive/connect-archive.sh
Normal file
2
run/rclone_archive/connect-archive.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash -eu
|
||||
# Nothing to do.
|
||||
2
run/rclone_archive/disconnect-archive.sh
Normal file
2
run/rclone_archive/disconnect-archive.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash -eu
|
||||
# Nothing to do.
|
||||
1
run/rclone_archive/verify-archive-configuration.sh
Normal file
1
run/rclone_archive/verify-archive-configuration.sh
Normal file
@@ -0,0 +1 @@
|
||||
#!/bin/bash -eu
|
||||
@@ -7,7 +7,7 @@ function log () {
|
||||
echo "$1" >> "$LOG_FILE"
|
||||
}
|
||||
|
||||
if [ -r "/root/.teslaCamPushoverCredentials" ] && [ $NUM_FILES_MOVED > 0 ]
|
||||
if [ -r "/root/.teslaCamPushoverCredentials" ] && [ $NUM_FILES_MOVED -gt 0 ]
|
||||
then
|
||||
log "Sending Pushover message for moved files."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user