index : devops | |
Archlinux32 devs' convenience-scripts | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-08-07 10:25:00 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-08-07 10:25:00 +0200 |
commit | 737d89dbaee53888ce1499483ee0ed3d44444826 (patch) | |
tree | d929358aa1940aafb3eb14cb258abf898ab76ad4 /re-bootstrap-slave-db | |
parent | 86ea009191864b2d4ef974d8ae69e21c01d2c780 (diff) |
-rwxr-xr-x | re-bootstrap-slave-db | 19 |
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 |