zhangyuannie / butter

Btrfs snapshot management GUI frontend
GNU General Public License v3.0
125 stars 4 forks source link

Post snapshot hooks #15

Open sidevesh opened 1 year ago

sidevesh commented 1 year ago

Describe the problem your feature would solve

Be able to take actions after a snapshot like clean up or move backup to offsite etc

Describe the solution you'd like

Could you add an option to execute scripts on state changes like when a snapshot completes

Additional context

Post / Pre operation hooks is a fairly common feature in most backup suites and even though I love Butter's simplicity, just having this feature would allow for a lot more complex workflows for those who want it. Personally I want to use this for sending the btrfs snapshot to a local server to have backups be available even if the device fails, there are a lot of BTRFS backup solutions but seems like none of them have gotten around to or have any ability to backup to a remote service, which I think is fairly critical

sidevesh commented 11 months ago

@zhangyuannie are you planning on working on this or have an idea of a timeframe when this can be implemented ? If you don't have plans to add this anytime soon then would you be interested and merge in if I implement this in a PR ?

zhangyuannie commented 11 months ago

Hey @sidevesh, PR welcomed! :smile:

sidevesh commented 11 months ago

I am thinking of moving the Preferences option to a bottom tab instead of the dropdown menu, and adding the Post snapshot, Post cleanup hook script text fields there along with toggles for #19 (Don't backup on battery power) and #20 (Remove older snapshots if low on space) and text field to set low space limit, does that sound good ?

sidevesh commented 11 months ago

Also, I guess Don't backup on battery and Remove older snapshots when low on space limit would have to be added to gschema to store these local config, again @zhangyuannie can you confirm if the above changes that I have outlined are okay with you ?

zhangyuannie commented 10 months ago

I am thinking of moving the Preferences option to a bottom tab instead of the dropdown menu

I'm feeling they should probably be in the "Schedule" view, given these are schedule settings.

Also, I guess Don't backup on battery and Remove older snapshots when low on space limit would have to be added to gschema

You probably have to add them to PKGSYSCONFDIR instead of gschema, as this is not a user config but a device wide / system config.

Overall LGTM! Please send your PR feature by feature btw so it's easier to review. Thanks!

sidevesh commented 10 months ago

I'm feeling they should probably be in the "Schedule" view, given these are schedule settings.

19 is gonna be applicable only for the scheduled backups (if user attempts backup manually then it does not matter if they are on battery power or not, their choice),

so that being in Schedule makes sense,

20 and post snapshot hooks would be applicable for manual backups as well as scheduled backups so shouldn't they not be in Schedule otherwise it would seem like those are not only applicable for scheduled backups and not manual ones ?

Hence moving those to a Preferences tab made sense, what do you think?

zhangyuannie commented 10 months ago

20 likely shouldn't be applicable for manual backups as you mostly likely don't want a manual backup to be cleaned up.

For post snapshot hooks yeah, it makes sense to put it in Preferences. Let's use the existing preferences in the hamburger menu first as my prediction is that this is likely not a feature an average user would use, although a needed one. We can consider making it into a tab in the future if necessary.

Thanks!