diff options
-rwxr-xr-x | mysql/mysql_backup.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mysql/mysql_backup.sh b/mysql/mysql_backup.sh index 5c73da0..a255314 100755 --- a/mysql/mysql_backup.sh +++ b/mysql/mysql_backup.sh @@ -41,6 +41,10 @@ _check_tools mysqlshow mysqldump ncftpput echo "Started backup of mysql databases ($(date +%c)):" | _log echo | _log +# pause the replication to be able to do consistent backups +echo "STOP SLAVE SQL_THREAD;" | mysql -h${MYSQL_SERVER} -u${MYSQL_USER} \ + -p${MYSQL_PASSWORD} + # create temporary dir mkdir -p ${TMP_DIRECTORY} TMP_DIR=$(mktemp -d --tmpdir=${TMP_DIRECTORY}) @@ -58,6 +62,10 @@ do ${db} | bzip2 -zc > "${BACKUP_PREFIX}_${db}.sql.bz2" done +# restart the replication +echo "START SLAVE SQL_THREAD;" | mysql -h${MYSQL_SERVER} -u${MYSQL_USER} \ + -p${MYSQL_PASSWORD} + # echo created log of file sizes du -sch * | _log echo | _log |