The following script shows an example of how to re-synchronise the master-slave status for the VoIPexaminer databases.

#!/bin/sh
#
# shell script to resync a master and a slave
#
# The script should not interfere with the Master's normal operation.
# The --single-transaction makes sure only minimal locking is required while starting the dump

# defining vars
master_ip=10.4.5.239
slave_ip=10.4.5.165
master_user=root
master_pw=mysqlroot
slave_user=root
slave_pw=mysqlroot
databases="xmonitor"
# list of databases to be resynced, typically only xmonitor

# actual script
echo stopping slave
mysql -h $slave_ip -u $slave_user --password=$slave_pw --execute="STOP SLAVE; RESET SLAVE;"
echo making dump including master info
mysqldump -h $master_ip -u $master_user --master-data --single-transaction --password=$master_pw --databases ${databases} > temp.sql

echo "dump made"

echo adding initial tables to the slave
mysql -h $slave_ip -u $slave_user --password=$slave_pw < temp.sql
echo restart slave
mysql -h $slave_ip -u $slave_user --password=$slave_pw --execute="SLAVE START;"
echo removing temp file
rm temp.sql
echo all done!