Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/re-bootstrap-slave-db
blob: cf44385bcbdec4edb91608c4248b5f95f11bf46b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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