0
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?
Are you sure that cron is running? Check the output of
ls -l | grep cron
for something like /usr/bin/crond. If your only process showing isgrep cron
or perhapsgrep --color=auto cron
then it isn't. You'll need to start thecron
server via whatever method it is your disto has for managing servers.service cron start
works on a number of popular distros. – 0xDAFACADE – 2014-08-16T03:31:25.677Yes, cron is running, although
ls -l | grep cron
isn't the command to tell me that.pgrep cron
returned a PID. I also added a job* * * * * touch /root/foo
, which worked as expected. – Mikkel – 2014-08-16T19:17:20.747