Code Monkey home page Code Monkey logo

Comments (5)

jefro108 avatar jefro108 commented on August 10, 2024

In the code where it had zfs I updated it with the full path which in my case was /sbin/zfs and now it works in cron.

from zfs-prune-snapshots.

yuriw avatar yuriw commented on August 10, 2024

Seems to work for me as:
copied zfs-prune-snapshots to /usr/bin
which zfs-prune-snapshots /usr/bin/zfs-prune-snapshots

added to sudo crontab -e
@daily /usr/bin/zfs-prune-snapshots -v 1s

from zfs-prune-snapshots.

dradux avatar dradux commented on August 10, 2024

Example directly from author's website:

11 0 * * * /opt/custom/bin/zfs-prune-snapshots -p automated_daily_   7d   >> /var/log/autosnap.log 2>&1
12 0 * * 0 /opt/custom/bin/zfs-prune-snapshots -p automated_weekly_  4w   >> /var/log/autosnap.log 2>&1
13 0 1 * * /opt/custom/bin/zfs-prune-snapshots -p automated_monthly_ 12M  >> /var/log/autosnap.log 2>&1
14 0 1 1 * /opt/custom/bin/zfs-prune-snapshots -p automated_yearly_  10y  >> /var/log/autosnap.log 2>&1

from zfs-prune-snapshots.

bahamas10 avatar bahamas10 commented on August 10, 2024

The issue you are seeing is caused by your crontab not having a $PATH environmental variable with zfs in it. You can fix this in multiple ways, but it's outside the scope of this zfs-prune-snapshots tool to handle managing your $PATH variable. You can:

1

Specify the PATH in your cron line (if your cron supports it), ie:

0 0 * * * PATH=/bin:/sbin:/usr/bin:/usr/sbin:/whateveryouwant zfs-prune-snapshots ...

2

Have cron fire off a "helper" script whose job it is to call zfs-prune-snapshots, ie:

0 0 * * * /path/to/my-helper-program

and my-helper-program would look something like:

#!/bin/sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/whateveryouwant
exec zfs-prune-snapshots ...

3

Make sure cron is running/started with the proper PATH variable set.

from zfs-prune-snapshots.

bahamas10 avatar bahamas10 commented on August 10, 2024

Closing - feel free to reopen if I misunderstood the original issue and something is still broken.

from zfs-prune-snapshots.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.