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

Override path like in zfs-auto-snapshot.cron.frequent #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

proudier
Copy link

@proudier proudier commented Jan 3, 2020

Using the installation method described in README on a fresh CentOS 8 install will result in the {hourly,daily,weekly,monthly} snapshots not being created while the 'frequent' ones are.

In the system log, one can read:

Dec 29 13:01:01 obfuscated CROND[6339]: (root) CMDOUT (/etc/cron.hourly/zfs-auto-snapshot:)
Dec 29 13:01:01 obfuscated CROND[6339]: (root) CMDOUT ()
Dec 29 13:01:01 obfuscated CROND[6339]: (root) CMDOUT (which: no zfs-auto-snapshot in (/sbin:/bin:/usr/sbin:/usr/bin))

By default, the script is installed under /usr/local/bin, which is not in the PATH when cron runs.
This PR add a PATH declaration to the {hourly,daily,weekly,monthly} cron files, similar to the frequent one.

@ahesford
Copy link

This is not portable. Not all cron implementations support a PATH declaration in crontab pieces. One affected implementation is dcron.

@antoinetran
Copy link

Hi, I reproduce the same issue and have the same conclusion as this pull request! Can we merge that?

Also about the non portable remark (@ahesford ) concerning /etc/cron.d/zfs-auto-snapshot (which is not part of this pull request BTW), one can just do

PATH="/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"

*/15 * * * * root which zfs-auto-snapshot > /dev/null || exit 0 ; zfs-auto-snapshot --quiet --syslog --label=frequent --keep=4 //

=>

*/15 * * * * root export PATH="/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin" && which zfs-auto-snapshot > /dev/null || exit 0 ; zfs-auto-snapshot --quiet --syslog --label=frequent --keep=4 //

Maybe @proudier can you add that to your PR?

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.

3 participants