From f7418224036f8c089547918059c148b25d337853 Mon Sep 17 00:00:00 2001 From: "Fco. Javier Delgado del Hoyo" Date: Sat, 5 Feb 2022 13:01:53 +0100 Subject: [PATCH] fix wrong placement of MYSQLDUMP_OPTS variable --- Dockerfile | 3 ++- README.md | 2 +- backup.sh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index d19d572..a1ee8c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,8 @@ COPY --from=binary /go/bin/dockerize /usr/local/bin ENV CRON_TIME="0 3 * * sun" \ MYSQL_HOST="mysql" \ MYSQL_PORT="3306" \ - TIMEOUT="10s" + TIMEOUT="10s" \ + MYSQLDUMP_OPTS="--quick" COPY ["run.sh", "backup.sh", "restore.sh", "/"] RUN mkdir /backup && \ diff --git a/README.md b/README.md index 8464811..4280622 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ docker container run -d \ - `MYSQL_PASS`: The password of your mysql database. - `MYSQL_PASS_FILE`: The file in container where to find the password of your mysql database (cf. docker secrets). You should use either MYSQL_PASS_FILE or MYSQL_PASS (see examples below). - `MYSQL_DATABASE`: The database name to dump. Default: `--all-databases`. -- `MYSQLDUMP_OPTS`: Command line arguments to pass to mysqldump. Example: `--single-transaction`. +- `MYSQLDUMP_OPTS`: Command line arguments to pass to mysqldump (see [mysqldump documentation](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html)). - `CRON_TIME`: The interval of cron job to run mysqldump. `0 3 * * sun` by default, which is every Sunday at 03:00. It uses UTC timezone. - `MAX_BACKUPS`: The number of backups to keep. When reaching the limit, the old backup will be discarded. No limit by default. - `INIT_BACKUP`: If set, create a backup when the container starts. diff --git a/backup.sh b/backup.sh index 76a3d5a..7082e01 100755 --- a/backup.sh +++ b/backup.sh @@ -21,7 +21,7 @@ do echo "==> Dumping database: $db" FILENAME=/backup/$DATE.$db.sql LATEST=/backup/latest.$db.sql - if mysqldump --single-transaction -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" "$db" "$MYSQLDUMP_OPTS" > "$FILENAME" + if mysqldump --single-transaction "$MYSQLDUMP_OPTS" -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" "$db" > "$FILENAME" then EXT= if [ -z "${USE_PLAIN_SQL}" ]