Improve README.md: quote the DB_DUMP_BEGIN example values
In README.md the description of DB_DUMP_BEGIN says:
What time to do the first dump. Defaults to immediate. Must be in one of two formats Absolute HHMM, e.g.
2330or0415Relative +MM, i.e. how many minutes after starting the container, e.g.+0(immediate),+10(in 10 minutes), or+90in an hour and a half
Seeing this, I wrote the following in my docker-compose.yml:
version: "3.7"
services:
...
db-backup:
container_name: db-backup
image: tiredofit/db-backup
volumes:
- "/mnt/tank/DBDUMP/semaphore_db:/backup"
environment:
...
DB_DUMP_BEGIN: 0545
...
However, I found that backups are created immediately instead of at 05:45, and I found something like this in the logs:
date: invalid date '20220131357'
Apparently, when a number is specified with prefix 0, it is treated as octal. 0545 (octal) = 357 (decimal). This was the cause of the error.
I fixed this by quoting like DB_DUMP_BEGIN: "0545"
Could you please quote the examples in the README.md too like the below, so that newcomers won't make the same mistake again? Thank you:
Absolute HHMM, e.g.
"2330"or"0415"
Interesting, - I've been using unqoted for about 5 years now and this is the first time it has come up. Mind you, I use the format of
ENV_VAR=VALUE instead of the colons, I also stay at docker-compose ver 2.4 for the most part. I wonder if others experience the same issue?
Thank you for your comment.
I have further searched this issue and found this explanation about using colon vs equal signs and about quoting.
Honestly I didn't pay attention to using colons vs equal signs in docker compose and use both interchangeably. Now I know the difference.
See if you have anything to add regarding this on the README. If not, this issue may be closed.
Can confirm i just had the same issue. I looked back through my log to see why my DB didn't backup at 00:00 and saw the following message:
Changed the value in portainer with quotation marks and after updating the stack the container is now showing the correct date + time
This issue affects me, too. As it seems, image doesn't recognise the date variables at all.
I tried both using = and : , both with and without quotes, on multiple versions of compose (3 and 2.4).
The image just keeps restarting (restart: always was set). It is currently running once a day using a GitLab Runner config, which isn't ideal, but works.
The logs don't say anything about any sort of timestamp or time settings whatsoever.
You can find them here.
My current compose file:
version: '2.4'
mariadb-replication-slave:
image: mariadb:latest
[...]
backup-mariadb:
container_name: backup-mariadb
image: ixdotai/mariadb-backup:latest
# restart: always
environment:
DB_TYPE: mysql
DB_HOST: mariadb-replication-slave
DB_PORT: 3306
DB_USER: root
DB_PASS: [REDACTED]
DB_DUMP_FREQ: "1440"
DB_CLEANUP_TIME: "10080"
DB_DUMP_BEGIN: "0300"
DB_DUMP_DEBUG: "true"
volumes:
- /opt/mariadb-backup:/backup