Make script more robust with handling network timeouts etc

This commit is contained in:
2026-10-17 20:02:47 +03:00
parent b181b2191b
commit 95686db684
2 changed files with 142 additions and 49 deletions
+11 -4
View File
@@ -71,13 +71,20 @@ The SSH method reuses one multiplexed connection per NAS, so a key passphrase is
| `--config FILE`| Use a different NAS list (default `./nas_list.conf`) |
| `--dest DIR` | Destination root (default `/mnt/stor0/qnap`) |
| `--only NAME` | Only process one NAS entry by name |
| `--jobs N` | Number of NAS devices to process in parallel (default 1) |
| `--dry-run` | Pass `--dry-run` to rsync, no changes made |
| `--jobs N` | Number of NAS devices to process in parallel (default 1) |
| `--retries N` | Retries after a failed network operation (default 3) |
| `--retry-delay SEC` | Seconds between retries (default 5) |
| `--dry-run` | Pass `--dry-run` to rsync, no changes made |
| `--list-only` | Only discover and print shares, don't transfer |
| `--no-ui` | Disable the progress dashboard, use plain rsync output |
QNAP system folders (`@Recycle`, `.@__thumb`, `.system`, snapshots, etc.) are skipped automatically.
Re-running the script is safe/idempotent — rsync only copies new or changed files.
QNAP system folders (`@Recycle`, `.@__thumb`, `.system`, snapshots, etc.) are skipped automatically.
Network discovery, mounts, and each rsync transfer are retried (three retries by default); SSH
connections also use keepalives and timeouts. Interrupted file data is kept in rsync's
`.rsync-partial` directories. If all retries fail, the script exits with an error but retains
completed files and partial data. Fix the connection and run the script again: rsync skips files
that already match and resumes/re-copies incomplete or changed files. Per-share logs identify
transfers that still need attention.
If the files were edited on Windows, strip CRLF line endings on TrueNAS before running:
`sed -i 's/\r$//' migrate.sh generate_ssh_keys.sh nas_list.conf`