I wrote a small script to handle my zfs backups. When i run it by hand, it works well:

/root/bin/zfs-backup -k 7 -p zfs-auto-snap_daily -r vm/containers tank/backups

But running it in cron like so, throws an error "The file system 'vm/containers' doesn't exists."

30 0 * * * root /root/bin/zfs-backup -k 7 -p zfs-auto-snap_daily -r vm/containers tank/backups

It was all about zfs not being found because of the limited PATH in crontabs (/usr/bin:/bin), I added the full path to zfs in my script (/sbin/zfs) and it now works.

  • 1
    Whenever something works in a regular shell but not through cron, always always always verify your environment. Odds are pretty good that that's where your problem is. – a CVn Nov 4 '16 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.