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

support a cron expression #4

Closed
clescot opened this issue Feb 13, 2016 · 9 comments
Closed

support a cron expression #4

clescot opened this issue Feb 13, 2016 · 9 comments

Comments

@clescot
Copy link

clescot commented Feb 13, 2016

Hi,
it would be useful to support a cron expression, as an alternative to a delay.
If the merge with the https://github.com/iainmckay/docker-mysql-backup project occurs, a cron expression will be present in the resulting merge.

best regards,

Charles.

@deitch
Copy link
Collaborator

deitch commented Feb 13, 2016

I like it very much. We have an open issue at iainmckay/docker-mysql-backup#2 where we are discussing it.

@patakijv
Copy link

Is it still being considered to handle scheduling inside the container using cron instead of a continuous run and wait loop?

@deitch
Copy link
Collaborator

deitch commented Nov 12, 2018

It hasn't been discussed in quite some time, still very open to it.

How would it work? Are you just thinking of a different scheduling UI, so instead of DB_DUMP_BEGIN and DB_DUMP_FREQ, it would take a crontab expression?

I assume the implementation would continue to use a loop for actual implementation, just match by the crontab format?

@michabbb
Copy link

i personally feel very comfort with the while loop, because every extra service that is involved, can cause trouble, so less dependencies, less problems. because of the RUN_ONCE logic here, i can use the cron of my host where the container is running, which is perfectly fine for me,
because usually a container does not need a cron, the host instead, always has one, so why install a 2nd service if i already have one? but these are only my personal thoughts about that....

@patakijv
Copy link

@deitch I think the crontab entry format variable as an alternative to the begin/freq variables implementation would be easiest to keep it simple. It should only be an override to default behavior so other people who want to use it as a run once if they choose would just use the current default implementation.

An example of another approach with a separate wrapper image for the cron implementation referencing the lower level (this) image to implement the cronjob control is another idea - so the cron implementation at the docker level comes in as an alternative but with a second image layer above the main image (i.e. mysql-backup-cron that uses FROM deitch/mysql-backup). Just another idea.

In our case, the goal would be to remove the need for the host to use cron to manage the jobs, to keep all things configurable in one place (i.e. the docker-compose file) and to further reduce the need to have access to the host at that level but still have all of the controls one would expect if they were administering at the host level (i.e. standard tools like cron, just in the container)

@deitch
Copy link
Collaborator

deitch commented Jan 24, 2019

the goal would be to remove the need for the host to use cron to manage the jobs, to keep all things configurable in one place (i.e. the docker-compose file) and to further reduce the need to have access to the host at that level but still have all of the controls one would expect if they were administering at the host level (i.e. standard tools like cron, just in the container)

That makes sense. The less you need the host, the more you can stop caring where it runs (and security is better).

@deitch
Copy link
Collaborator

deitch commented Jan 24, 2019

I am struggling with the cron algorithm. How to parse a cron expression and get a result that says, "next time to execute will be in x seconds". Any ideas?

@deitch
Copy link
Collaborator

deitch commented Jan 24, 2019

It actually is easy to say, "should I do this now", but much harder to say "when should I do this next?" Systems with actual cron just go ahead and test every second, and get a boolean true/false. I would like to avoid that expensive loop for an administrative process.

@deitch
Copy link
Collaborator

deitch commented Jan 24, 2019

See #83 . Initial testing is good, would love to see more.

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

4 participants