rsync will not be using the mnt/archive folder

It'll instead bypass and just call itself on its own
This commit is contained in:
Gocnak
2018-10-20 05:30:57 -04:00
parent b60b787953
commit de3371f00c
3 changed files with 23 additions and 16 deletions

View File

@@ -7,6 +7,16 @@ function log () {
source /root/.teslaCamRsyncConfig
rsync -au /mnt/archive $user@$server:$path
nfiles=$(rsync -auh --stats /mnt/cam/TeslaCam/saved* $user@$server:$path | awk '/files transferred/{print $NF}')
log "Successfully synced files through rsync!"
if [ $nfiles > 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!"
else
log "No files to archive through rsync!"
fi

View File

@@ -82,19 +82,10 @@ function move_clips_to_archive () {
done
log "Moved $move_count file(s)."
if [ $move_count > 0]
if [ -r "/root/.teslaCamPushoverCredentials" ] && [ $move_count > 0]
then
if [ -r "/root/.teslaCamRsyncConfig" ]
then
log "Archiving through rsync..."
/root/bin/archive-rsync
fi
if [ -r "/root/.teslaCamPushoverCredentials" ]
then
log "Sending Pushover message for copied files."
/root/bin/send-pushover $move_count
fi
log "Sending Pushover message for copied files."
/root/bin/send-pushover $move_count
fi
log "Finished moving clips to archive."
@@ -143,7 +134,13 @@ fix_errors_on_cam_drive
ensure_cam_drive_is_mounted
move_clips_to_archive
if [ -r "/root/.teslaCamRsyncConfig" ]
then
log "Archiving through rsync..."
/root/bin/archive-rsync
else
move_clips_to_archive
fi
unmount_cam_drive

View File

@@ -108,7 +108,6 @@ function create_usb_drive_backing_files () {
function configure_archive () {
echo "Configuring the archive..."
mkdir /mnt/archive
if [ $RSYNC_ENABLE = true ]
then
echo "Configuring for Rsync..."
@@ -117,6 +116,7 @@ function configure_archive () {
echo "path=$RSYNC_PATH" > /root/.teslaCamRsyncConfig
else
echo "Configuring for a shared drive..."
mkdir /mnt/archive
local archive_server_ip_address="$(ping -c 1 -w 1 $archiveserver 2>/dev/null | head -n 1 | grep -o -e "(\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\})" | tr -d '()')"
echo "//$archive_server_ip_address/$sharename /mnt/archive cifs vers=3,credentials=/root/.teslaCamArchiveCredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0" >> /etc/fstab