1

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
Laurent
  • 406
  • 1
  • 4
  • 14

1 Answers1

3

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.

Laurent
  • 406
  • 1
  • 4
  • 14
  • 2
    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. – user Nov 04 '16 at 21:51