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

Adds a cronjob-like mechanism #232

Merged
merged 5 commits into from
Nov 5, 2023
Merged

Conversation

benvia
Copy link
Contributor

@benvia benvia commented Jun 14, 2023

Based on the issue #214 I propose a solution to use DB_DUMP_BEGIN as a base time to run like a cronjob.

If the DB_DUMP_BEGIN is specified in hh:mm:ss format, then the system uses it as a base time with DB_DUMP_FREQ as the recursion.

I'm open to comments about this solutions.

@tiredofit
Copy link
Owner

Hi @benvia - Thanks for the PR and apologies on the delay. I am in the midst of preparing a major release for db-backup and reviewing PRs. If I am to understand correctly entering in a HH:MM:SS format could take the place of the existing HHMM format which is not persisting after a container restart?

I am open is this will resolve the issue that this originally came up, could I request some examples and if I respond that this makes sense to go in perhaps some explanation in the README.md file? I would likely be refactoring your code to fit with the new scheduling components on my end but the main bulk of your work would be there in inspiration. I am looking to release this month after it simmers for a bit and I understand if there are any hidden bugs I haven't caught.

@benvia
Copy link
Contributor Author

benvia commented Nov 4, 2023

Hi @tiredofit,

Thank you for your feedback.

If you put a HH:mm:ss value for DB_DUMP_BEGIN parameter then the first backup will be executed at this time. If this time is in the past then the function will calculate the next execution based on time of DB_DUMP_BEGIN and DB_DUMP_FREQ.

This solution is partially answering the issue #214 as the code is not taking care of the date but only the time. I could take a look to extend the code to support date also.

Example 1:
Current time : 07:04:01
DB_DUMP_BEGIN : 06:00:00
DB_DUMP_FREQ : 10
=> Next backup 07:10:00

Example 2:
Current time : 07:04:01
DB_DUMP_BEGIN : 10:25:00
DB_DUMP_FRE : 10
=> Next backup 10:25:00

@benvia
Copy link
Contributor Author

benvia commented Nov 4, 2023

I've modify the code to support a full date and time value. Now the DB_DUMP_BEGIN must be a full date and time value in form YYYY-MM-DD HH:mm:ss (ex: 2023-10-03 18:05:30)

@tiredofit
Copy link
Owner

Excellent! This will work out and should solve the original issue and add another format of scheduling.

@tiredofit tiredofit merged commit c5c026d into tiredofit:main Nov 5, 2023
@tiredofit
Copy link
Owner

Alright! We're merged. I've reworked in upcoming 4.x series your work, and it will be tagged as part of the new release shortly.

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

Successfully merging this pull request may close these issues.

2 participants