summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@vps-18a7a2b7.vps.ovh.ca>2023-05-24 16:50:12 -0400
committerroot <root@vps-18a7a2b7.vps.ovh.ca>2023-05-24 16:50:12 -0400
commita6d32e3398f2ec1913bbdb75b172c96724d04a57 (patch)
treeb683d883c03343cc27c4bb622b52b489909c3fe0
parent53870be8b0eece765e941e8851e9109dd135ef26 (diff)
respect db_host when calling mysqldump
-rwxr-xr-xwordpress/wordpress-rsync-push-site14
1 files changed, 12 insertions, 2 deletions
diff --git a/wordpress/wordpress-rsync-push-site b/wordpress/wordpress-rsync-push-site
index 09dc70c..225a6c4 100755
--- a/wordpress/wordpress-rsync-push-site
+++ b/wordpress/wordpress-rsync-push-site
@@ -44,6 +44,16 @@ do_rsync()
44 rsync ${NO_ACT:+ -nv} -u -aRi --delete --partial "$conf_file" "$html_dir" "$remote_host":/"$target_dir" 44 rsync ${NO_ACT:+ -nv} -u -aRi --delete --partial "$conf_file" "$html_dir" "$remote_host":/"$target_dir"
45) } 45) }
46 46
47remote_mysqldump()
48{
49 if [ "$DO_NOT_USE_SSH" ]
50 then
51 mysqldump --host="$db_host" "$db_name"
52 else
53 ssh -- "$db_host" mysqldump "$db_name"
54 fi
55}
56
47do_mysqldump() 57do_mysqldump()
48{ ( 58{ (
49 case "$NO_ACT" in 59 case "$NO_ACT" in
@@ -58,12 +68,12 @@ do_mysqldump()
58 then 68 then
59 set -x 69 set -x
60 dumpfile=$(mktemp -p "$XDG_RUNTIME_DIR") || dumpfile=$(mktemp) 70 dumpfile=$(mktemp -p "$XDG_RUNTIME_DIR") || dumpfile=$(mktemp)
61 ssh "$db_host" -- mysqldump "$db_name" | gzip -c > "$dumpfile" 71 remote_mysqldump | gzip -c > "$dumpfile"
62 rsync --ignore-existing "$dumpfile" "$remote_host":"$of" 72 rsync --ignore-existing "$dumpfile" "$remote_host":"$of"
63 rm "$dumpfile" 73 rm "$dumpfile"
64 else 74 else
65 set -x 75 set -x
66 mysqldump "$db_name" | gzip -c | ssh "$remote_host" dd conv=notrunc "of=$of" 76 remote_mysqldump | gzip -c | ssh "$remote_host" dd conv=notrunc "of=$of"
67 fi 77 fi
68) } 78) }
69 79