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

Varying frequency file removal #2

Open
jamiemc1 opened this issue Jun 14, 2021 · 1 comment
Open

Varying frequency file removal #2

jamiemc1 opened this issue Jun 14, 2021 · 1 comment

Comments

@jamiemc1
Copy link

In the inspiration you linked they touch on having a unique script call for daily snapshots and lower frequency snapshots.

I would like to implement a varying frequency backup call. For example, in the previous day keep a backup every hour, in the previous week keep a backup every day, in the previous month keep a backup every week, etc.

I can certainly fork the repository and implement this logic. But it would make sense to push the changes upstream.

Given this, how would you approach the logic to cause zero changes to old .conf files?

I can see some changes would be needed in the functions deleteOld<XXX>Backups to include an additional argument to filterFilesToDelete. Additionally I would need to rebuild filterFilesToDelete to account for this logic.

Let me know if you have any ideas, I'll start building on the logic in the week.

Thanks.

@imthenachoman
Copy link
Owner

I really like this idea.

I can't see anyway to do this without adding new settings to the .conf files -- with hard-coded defaults in the .sh script for old .conf files that don't have the new settings.

It can get super complex/tricky very fast. For example, you may want specific rules for previous week, and someone may want specific rules for 2 weeks prior.

How are you thinking of handling the logic?

I can think of two options:

  • Add command line options/paramaters to nBackup.sh that reads in a delete rule (in some specific syntax). That way, you'd make X # of additional calls to nBackup.sh with rules for what to delete. It could even read multiple delete rules like nBackup.sh -d "delete rule syntax" -d "delete rule syntax" -d "delete rule syntax" ....
  • Allow setting X # of delete rules (in some specific syntax) in the .conf file that nBackup.sh iterates over. Something like:
    DELETE_RULE_1=....
    DELETE_RULE_2=....
    DELETE_RULE_A=....
    
    nBackup.sh would just iterate over all of the variables that start with DELETE_RULE.

Coming up with the delete rule syntax is the hard part.

I'm keenly interested to hear your thoughts.

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