From 506c48ba73c58648429dab11a2d48eb8a2dc0a83 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 5 Jun 2026 23:20:12 +0200 Subject: [PATCH] Fix: SQL import exclude backup dir, vervang process substitution door pipe, error handling in loop --- update-Nitrov3.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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