btrfs won't run from cron
- by Mikkel
I'm trying to set up a cron job to create a btrfs subvolume snapshot of my root partition. The command works perfectly if I run it from the command line, but nothing happens at the scheduled cron time. I've tried piping to logger and redirecting stdout/stderr to file, and not only is there no content, the file I'm logging to isn't even created.
The cron command I have is as follows:
0 0 * * * /sbin/btrfs subvolume snapshot / "/snapshots/$(date +%Y-%m-%d)"
I've tried prefixing it with /bin/bash, but that makes no difference. What am I missing?