Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to start selim13/automysqlbackup as a daemon? #11

Closed
janmottl opened this issue Dec 15, 2019 · 4 comments
Closed

How to start selim13/automysqlbackup as a daemon? #11

janmottl opened this issue Dec 15, 2019 · 4 comments

Comments

@janmottl
Copy link

How to start selim13/automysqlbackup as a daemon?

I am new in Docker.

This works fine but requires opened terminal:
sudo docker run
--name automysqlbackup
--network my-network
-v '/var/xxxxxxxx/backup/docker:/backup'
-e DBHOST=mariadb
-e DBNAMES=all
-e USERNAME=root
-e PASSWORD=xxxxxxxx
-e DBNAMES=all
-e CRON_SCHEDULE="10 06 * * *"
selim13/automysqlbackup:2.6-7-debian

I tried to start it as daemon (-d --restart unless-stopped) but it doesn't work unfortunatelly:
sudo docker run
--name automysqlbackup
--network my-network
-v '/var/xxxxxxxx/backup/docker:/backup'
-e DBHOST=mariadb
-e DBNAMES=all
-e USERNAME=root
-e PASSWORD=xxxxxxxx
-e DBNAMES=all
-e CRON_SCHEDULE="10 06 * * *"
-d --restart unless-stopped
selim13/automysqlbackup:2.6-7-debian

What do I wrong? Thanks

@selim13
Copy link
Owner

selim13 commented Dec 15, 2019

Hello!
It seems you are doing everything right. I've just copy-pasted your command and docker successfully launched detached container (-d) that survived docker daemon restart (--restart unless-stopped).

What makes you think that something is wrong?

@janmottl
Copy link
Author

Hi Dmitry,
thanks for immediate answer.
yes, container starts correctly with -d. But backup is not started at time specified in -e CRON_SCHEDULE="10 06 * * *".
I use Ubuntu 18.04 and Docker 19.03.5
I'm sorry for incomplete specification.
Jan

@selim13
Copy link
Owner

selim13 commented Dec 15, 2019

There should not be any difference for cron between starting container in foreground or detached mode.
Try passing CRON_SCHEDULE="* * * * *" to run the automysqlbackup cron job every minute to see whether backups are working.

Also it may be possible that container uses UTC timezone, so 10 06 * * * will be in UTC rather than your local timezone. But that's only guessing.

@janmottl
Copy link
Author

janmottl commented Dec 16, 2019

CRON_SCHEDULE="* * * * *" runs correctly.
You are right that it is necessary specify UTC time. Our is +1 hour.

The problem was in my wrong hour specification. Leading zero in hour makes troubles. I should use CRON_SCHEDULE="10 6 * * *" instead of CRON_SCHEDULE="10 06 * * *".

Many thanks for help. Noe it runs :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants