Fixed latest backup symlink issues
Code was in the wrong place (link being added when the backup failed only). Also made the symlink relative to the current folder so that the drive can be mounted with a different path.
This commit is contained in:
+9
-2
@@ -226,12 +226,19 @@ while [ "1" ]; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$RSYNC_EXIT_CODE" != "0" ]; then
|
if [ "$RSYNC_EXIT_CODE" != "0" ]; then
|
||||||
rm -f $DEST_FOLDER/latest
|
|
||||||
ln -s $DEST $DEST_FOLDER/latest
|
|
||||||
fn_log_error "Exited with error code $RSYNC_EXIT_CODE"
|
fn_log_error "Exited with error code $RSYNC_EXIT_CODE"
|
||||||
exit $RSYNC_EXIT_CODE
|
exit $RSYNC_EXIT_CODE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Add symlink to last successful backup
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
cd "$DEST_FOLDER"
|
||||||
|
rm -f -- "latest"
|
||||||
|
ln -s -- $(basename -- "$DEST") "latest"
|
||||||
|
cd -
|
||||||
|
|
||||||
rm -- "$INPROGRESS_FILE"
|
rm -- "$INPROGRESS_FILE"
|
||||||
# TODO: grep for "^rsync error:.*$" in log
|
# TODO: grep for "^rsync error:.*$" in log
|
||||||
fn_log_info "Backup completed without errors."
|
fn_log_info "Backup completed without errors."
|
||||||
|
|||||||
Reference in New Issue
Block a user