Sitelet https://github.com/codetot-web/runcloud-bash-scripts/pull/24
Skip to content

fix(wp-migration): SSH multiplex + fail loudly on DB import error (v0.0.1.2) - #24

Merged
khoipro merged 1 commit into
mainfrom
fix/23-ssh-multiplex-and-db-error
May 2, 2026
Merged

khoipro merged 1 commit into
mainfrom
fix/23-ssh-multiplex-and-db-error

Conversation

@khoipro

@khoipro khoipro commented May 2, 2026

Copy link
Copy Markdown
Member

Summary

  • SSH multiplexing: enables ControlMaster=auto + ControlPersist=10m so password is prompted at most once per migration run, not ~8 times.
  • DB import error visibility: mysql exit code is no longer masked by grep -v ... || true. Failures now abort with an actionable hint instead of being followed by a bogus "Database imported successfully" line.
  • Bumps VERSION to 0.0.1.2.

Closes #23.

Test plan

  • bash -n wp-migration.sh passes
  • Re-run migration jp1 → sg4 — expect single password prompt, then silent reuse
  • Confirm a deliberate auth failure aborts the script with the new error message instead of falsely claiming success

🤖 Generated with Claude Code

…loses #23)

Two UX/correctness fixes for wp-migration.sh:

1. SSH connection multiplexing
   The script runs ~8 separate ssh/rsync invocations. With password auth
   the user was prompted every single time. Add ControlMaster=auto +
   ControlPath in a per-run mktemp dir + ControlPersist=10m so the first
   connection opens a control socket and subsequent calls reuse it.
   Trap on EXIT cleans up the socket dir.

2. Database import error masking
   The mysql import was piped through `grep -v ... || true`, which
   masked real failures: an `ERROR 1045 Access denied` would print to
   the screen and the very next line would still claim "Database
   imported successfully". Switch to `bash -s` heredoc so process
   substitution `2> >(grep -v ...)` filters only deprecation warnings
   without touching mysql's exit code, capture status, exit with it.
   Local side gates the success message behind `if !` and prints an
   actionable hint about destination DB/user/password requirements.

Bumps VERSION to 0.0.1.2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@khoipro
khoipro merged commit f16debb into main May 2, 2026
@khoipro
khoipro deleted the fix/23-ssh-multiplex-and-db-error branch May 2, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wp-migration.sh: password prompt repeats per SSH op + DB import error masked

1 participant