mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2025-01-18 16:22:33 +01:00
Update backup.sh
added --single-transaction parameter to "halt" the mysql database while exporting
This commit is contained in:
parent
4e5a9162f4
commit
9501648ce9
1 changed files with 1 additions and 1 deletions
|
@ -14,7 +14,7 @@ do
|
||||||
echo "==> Dumping database: $db"
|
echo "==> Dumping database: $db"
|
||||||
FILENAME=/backup/$DATE.$db.sql
|
FILENAME=/backup/$DATE.$db.sql
|
||||||
LATEST=/backup/latest.$db.sql.gz
|
LATEST=/backup/latest.$db.sql.gz
|
||||||
if mysqldump -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" $db $MYSQLDUMP_OPTS > "$FILENAME"
|
if mysqldump --single-transaction -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" $db $MYSQLDUMP_OPTS > "$FILENAME"
|
||||||
then
|
then
|
||||||
gzip "-$GZIP_LEVEL" -f "$FILENAME"
|
gzip "-$GZIP_LEVEL" -f "$FILENAME"
|
||||||
echo "==> Creating symlink to latest backup: $(basename "$FILENAME".gz)"
|
echo "==> Creating symlink to latest backup: $(basename "$FILENAME".gz)"
|
||||||
|
|
Loading…
Reference in a new issue