The command I use to make a backup of the cron file is:
Code:
crontab -l > ~/readynas/Tim/IT/p5e/cron_$(date +%Y%m%d_%H%M).bak
Which when executed manually from the CLI generates a file called cron_20151031_1234.bak (depending on date & TOD of course) in the ~/readynas/Tim/IT/p5e folder. No issue whatsoever.
However when I put this in cron to execute this at midnight each night, nothing gets generated. extract from cron file below
Code:
# Backup Cron daily at midnight
0 0 * * * * crontab -l > ~/readynas/Tim/IT/p5e/cron_$(date +%Y%m%d_%H%M).bak
It's the exact same bit of code, but I am unsure why it's not being executed from the cron job. Do you know why this is not working please?
Kind regards
Tim