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

Allow overriding the default options #106

Open
paride opened this issue May 21, 2019 · 2 comments
Open

Allow overriding the default options #106

paride opened this issue May 21, 2019 · 2 comments

Comments

@paride
Copy link

paride commented May 21, 2019

zfs-auto-snapshot is great for its simplicity, however having the possibility to set the default options would be a great plus. This could be done for example by sourcing /etc/default/zfs-auto-snapshot after setting the opt_ defaults, here:

https://github.com/zfsonlinux/zfs-auto-snapshot/blob/master/src/zfs-auto-snapshot.sh#L46

The /etc/default/zfs-auto-snapshot may in this way override any of those options. This is especially important for people installing the tool from a distribution package, as modifying files installed by a package is generally not a good idea.

@maniac0s
Copy link

I second that. For instance I'd like to have predictable file names for the snap created including the exact date string, so I can zfs send the created snapshot to a backup system as soon as it was created.

@paride
Copy link
Author

paride commented Jul 10, 2019

Another solution could be using the shell parameter expansion, like this:

: "${opt_backup_full:=}"
: "${opt_backup_incremental:=}"
: "${opt_default_exclude:=1}"
[...]

to allow the variables to be overridden from the environment. The crontab entries should then source the defaults file before running zfs-auto-snapshot. This solution allows easy integration with systemd timers and service files.

Warning: I didn't test any of this :)

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