mirror of
https://github.com/cimryan/teslausb.git
synced 2026-03-01 04:30:33 +00:00
Make send-pushover safe to always invoke, and always invoke it. Split CIFS archiving to archive-cifs.sh
This commit is contained in:
@@ -1,24 +1,16 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
LOG_FILE=/tmp/archive-rsync.log
|
||||
|
||||
function log () {
|
||||
echo "$( date )" >> "$LOG_FILE"
|
||||
echo "$1" >> "$LOG_FILE"
|
||||
}
|
||||
log "Archiving through rsync..."
|
||||
|
||||
source /root/.teslaCamRsyncConfig
|
||||
|
||||
nfiles=$(rsync -auvh --stats --log-file=/tmp/archive-rsync-cmd.log /mnt/cam/TeslaCam/saved* $user@$server:$path | awk '/files transferred/{print $NF}')
|
||||
num_files_moved=$(rsync -auvh --stats --log-file=/tmp/archive-rsync-cmd.log /mnt/cam/TeslaCam/saved* $user@$server:$path | awk '/files transferred/{print $NF}')
|
||||
|
||||
if [ $nfiles > 0 ]
|
||||
/root/bin/send-pushover "$num_files_moved"
|
||||
|
||||
if [ $num_files_moved > 0 ]
|
||||
then
|
||||
if [ -r "/root/.teslaCamPushoverCredentials" ] && [ $nfiles > 0]
|
||||
then
|
||||
log "Sending Pushover message for copied files."
|
||||
/root/bin/send-pushover $nfiles
|
||||
fi
|
||||
log "Successfully synced files through rsync!"
|
||||
log "Successfully synced files through rsync."
|
||||
else
|
||||
log "No files to archive through rsync!"
|
||||
fi
|
||||
log "No files to archive through rsync."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user