Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/re-bootstrap-slave-db
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-08-07 10:25:00 +0200
committerErich Eckner <git@eckner.net>2019-08-07 10:25:00 +0200
commit737d89dbaee53888ce1499483ee0ed3d44444826 (patch)
treed929358aa1940aafb3eb14cb258abf898ab76ad4 /re-bootstrap-slave-db
parent86ea009191864b2d4ef974d8ae69e21c01d2c780 (diff)
re-bootstrap-slave-db new
Diffstat (limited to 're-bootstrap-slave-db')
-rwxr-xr-xre-bootstrap-slave-db19
1 files changed, 19 insertions, 0 deletions
diff --git a/re-bootstrap-slave-db b/re-bootstrap-slave-db
new file mode 100755
index 0000000..cf44385
--- /dev/null
+++ b/re-bootstrap-slave-db
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+if [ $# -ne 1 ] || [ ! -f "$1" ]; then
+ >&2 echo 're-bootstrap-slave-db $db-dump-file'
+ exit 1
+fi
+
+{
+ printf 'STOP SLAVE;\n'
+ xzcat "${1}"
+ xzcat "${1}" \
+ | sed -n '
+ s/^-- CHANGE MASTER TO /CHANGE MASTER TO /
+ T
+ p
+ '
+ printf 'START SLAVE;\n'
+} \
+| mysql -u root -p