Help Parsing a Log File

Hello all,

I am new to scripting and I have written a script that performs an Rsync on my NAS and then moves on to send me an email with the status etc. The problem is that I think Rsync is taking to long to complete and the IF statement is timing out, as it doesn't appear to move on.

Here is the bit code that I have and where it stops...

# Start sync

if rsync -a -v --update $BACKUP_FROM $BACKUP_TO &>> $LOG_FILE; then
        echo "$(date "+%Y-%m-%d %k:%M:%S") - Sync completed succesfully." >> $LOG_FILE
else
        echo "$(date "+%Y-%m-%d %k:%M:%S") - ERROR: Sync failed." >> $LOG_FILE
fi

# Email log file
cat "$LOG_FILE" | mail -s "$E_SUBJ" -r "$FROM_ADDR" "$TO_ADDR"

However, it doesn't get to the EMAIL LOG FILE bit. It writes the "Sync completed succesfully" to the log and stops. It does not move on. There is some more commands under the Email Log File section, and they also don't get process, so I know that it's not just failing the email.

Any ideas?

Cheers
John

anyone