OS X compatibility and splitted rsync errors and warnings
- Fixed bug on OS X since "--" is not supported by sed. - Changed sed to grep for consistency with rest of the code. - Splitted handling of rsync errors/warnings - for errors we quit with an error code, for warnings we print a message but complete the backup process.
This commit is contained in:
+7
-4
@@ -239,8 +239,11 @@ while : ; do
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Check whether rsync reported any errors
|
# Check whether rsync reported any errors
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
if [[ "$(sed -n '/rsync error:/p;/rsync:/p' -- "$LOG_FILE" | wc -l)" -ge 1 ]]; then
|
if [ -n "$(grep "rsync:" "$LOG_FILE")" ]; then
|
||||||
fn_log_error "Encountered error, please check $LOG_FILE for more details."
|
fn_log_warn "Rsync reported a warning, please check '$LOG_FILE' for more details."
|
||||||
|
fi
|
||||||
|
if [ -n "$(grep "rsync error:" "$LOG_FILE")" ]; then
|
||||||
|
fn_log_error "Rsync reported an error, please check '$LOG_FILE' for more details."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -252,8 +255,8 @@ while : ; do
|
|||||||
ln -vs -- "$(basename -- "$DEST")" "$DEST_FOLDER/latest"
|
ln -vs -- "$(basename -- "$DEST")" "$DEST_FOLDER/latest"
|
||||||
|
|
||||||
rm -f -- "$INPROGRESS_FILE"
|
rm -f -- "$INPROGRESS_FILE"
|
||||||
rm -- "$LOG_FILE"
|
rm -f -- "$LOG_FILE"
|
||||||
|
|
||||||
fn_log_info "Backup completed without errors."
|
fn_log_info "Backup completed without errors."
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user