diff --git a/update-Nitrov3.sh b/update-Nitrov3.sh index 1ba961b..4eb06a1 100755 --- a/update-Nitrov3.sh +++ b/update-Nitrov3.sh @@ -58,13 +58,13 @@ echo "--> Creating automatic database backup before update..." mkdir -p "$BACKUP_DIR" mariadb-dump $MYSQL_CRED --force --skip-lock-tables "$DB_NAME" > "$BACKUP_DIR/backup_$(date +%Y%m%d_%H%M%S).sql" || echo "--> Backup heeft ontbrekende tabellen (niet kritisch) — update gaat verder" -# --- Automatic SQL Import --- +# --- Automatic SQL Import (exclusief backup dir) --- echo "--> Checking for new SQL files..." if [ -d "$SQL_DIR" ]; then - while IFS= read -r -d '' sql_file; do + find "$SQL_DIR" -name "*.sql" -mmin -10 -not -path "$BACKUP_DIR/*" -print0 2>/dev/null | while IFS= read -r -d '' sql_file; do echo "--> Importing new SQL file: $(basename "$sql_file")" - mariadb $MYSQL_CRED --force "$DB_NAME" < "$sql_file" - done < <(find "$SQL_DIR" -name "*.sql" -mmin -10 -print0 2>/dev/null) + mariadb $MYSQL_CRED --force "$DB_NAME" < "$sql_file" || echo "--> Fout bij importeren $(basename "$sql_file"), naar volgende..." + done else echo "--> SQL directory not found, skipping SQL import." fi