mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2024-11-01 08:31:45 +01:00
fix wrong placement of MYSQLDUMP_OPTS variable
This commit is contained in:
parent
8992f162d7
commit
f741822403
3 changed files with 4 additions and 3 deletions
|
@ -29,7 +29,8 @@ COPY --from=binary /go/bin/dockerize /usr/local/bin
|
||||||
ENV CRON_TIME="0 3 * * sun" \
|
ENV CRON_TIME="0 3 * * sun" \
|
||||||
MYSQL_HOST="mysql" \
|
MYSQL_HOST="mysql" \
|
||||||
MYSQL_PORT="3306" \
|
MYSQL_PORT="3306" \
|
||||||
TIMEOUT="10s"
|
TIMEOUT="10s" \
|
||||||
|
MYSQLDUMP_OPTS="--quick"
|
||||||
|
|
||||||
COPY ["run.sh", "backup.sh", "restore.sh", "/"]
|
COPY ["run.sh", "backup.sh", "restore.sh", "/"]
|
||||||
RUN mkdir /backup && \
|
RUN mkdir /backup && \
|
||||||
|
|
|
@ -21,7 +21,7 @@ docker container run -d \
|
||||||
- `MYSQL_PASS`: The password of your mysql database.
|
- `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_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`.
|
- `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.
|
- `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.
|
- `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.
|
- `INIT_BACKUP`: If set, create a backup when the container starts.
|
||||||
|
|
|
@ -21,7 +21,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
|
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
|
then
|
||||||
EXT=
|
EXT=
|
||||||
if [ -z "${USE_PLAIN_SQL}" ]
|
if [ -z "${USE_PLAIN_SQL}" ]
|
||||||
|
|
Loading…
Reference in a new issue