Guest User

Untitled

a guest
Jan 20th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #!/bin/bash
  2. rm -f /tmp/dbcompareresult
  3. OUTPUT=`docker run --rm --link your_mysql_container:mysql -v /tmp/:/tmp/ macropage/mysql-utilities bash -c 'mysqldbcompare --skip-row-count --skip-data-check --difftype=sql --compact --server1=user:pwd@mysql:3306 --server2=user:pwd@slave:3306 db1:db2 |tee /tmp/dbcompareresult; exit ${PIPESTATUS[0]}'`
  4. if [ ! -f /tmp/dbcompareresult ]; then
  5. echo "CRITICAL COMMAND DID NOT RUN!";
  6. exit 2
  7. fi
  8.  
  9. if [ $? -ne 0 ]; then
  10. LASTLINE=`tail -1 /tmp/dbcompareresult`
  11. echo "CRITICAL - $LASTLINE"
  12. exit 2
  13. else
  14. echo "OK $LASTLINE - Slave Schema equal to Master"
  15. exit 0
  16. fi
Add Comment
Please, Sign In to add comment