Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xreplicate-db21
1 files changed, 17 insertions, 4 deletions
diff --git a/replicate-db b/replicate-db
index 431b70f..8244ff7 100755
--- a/replicate-db
+++ b/replicate-db
@@ -38,10 +38,23 @@ printf '\n\n\n%s\n%s\n\n\n\n\n' "${root_pw}" "${root_pw}" | \
tmp_file=$(mktemp)
trap 'rm "${tmp_file}"' EXIT
-ssh master@10.100.10.1 '
- cd /data/backup/mysql;
- ls -t | grep -m1 '"'"'^database-.*\.xz$'"'"' | xargs pv
-' > "${tmp_file}"
+database_dump=$(
+ ssh master@10.100.10.1 '
+ cd /data/backup/mysql;
+ ls -t
+ ' \
+ | grep -xm1 'database-.*\.xz'
+)
+
+find /tmp \
+ -maxdepth 1 \
+ -type f \
+ -name "${database_dump}" \
+ -exec rsync -avP {} "${tmp_file}" \;
+
+rsync -avP \
+ "master@10.100.10.1:/data/backup/mysql/${database_dump}" \
+ "${tmp_file}"
{
printf 'SHOW SLAVE STATUS;\n'