diff --git a/restore.sh b/restore.sh index af238d3..58c0ad1 100755 --- a/restore.sh +++ b/restore.sh @@ -15,10 +15,10 @@ MONGODB_PASS=${MONGODB_RESTORE_PASS:-${MONGODB_RESTORE_ENV_MONGODB_PASS}} FILE_TO_RESTORE=${1} -[[ -z "${1}" ]] && FILE_TO_RESTORE=$(ls /backup -N1 | grep -iv ".tgz" | sort -r | head -n 1) +[[ -z "${1}" ]] && FILE_TO_RESTORE=$(ls /backup -w1 | grep -iv ".tgz" | sort -r | head -n 1) echo "=> Restore database from ${FILE_TO_RESTORE}" -if mongorestore --drop --host ${MONGODB_RESTORE_HOST} --port ${MONGODB_RESTORE_PORT} ${USER_RESTORE_STR}${PASS_RESTORE_STR}${DB_RESTORE_STR} /backup/$FILE_TO_RESTORE; then +if mongorestore --drop --host ${MONGODB_RESTORE_HOST} --port ${MONGODB_RESTORE_PORT} ${USER_RESTORE_STR}${PASS_RESTORE_STR}${DB_RESTORE_STR} ${EXTRA_RESTORE_OPTS} /backup/$FILE_TO_RESTORE/${MONGODB_BACKUP_DB}; then echo " Restore succeeded" else echo " Restore failed"