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:
cimryan
2018-10-26 18:05:11 -07:00
committed by GitHub
9 changed files with 140 additions and 1 deletions

View 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"

View 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

View File

@@ -0,0 +1,2 @@
#!/bin/bash -eu
# Nothing to do.

View File

@@ -0,0 +1,2 @@
#!/bin/bash -eu
# Nothing to do.

View File

@@ -0,0 +1 @@
#!/bin/bash -eu

View File

@@ -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."