In the even of a crash I realize that I may not be backing up system and user cron jobs. How can I automate the backing up of my systems cron jobs?
2 Answers
Yeah another cronjob for the automation but in terms of collecting everything together, there are a few directories you want to cater for:
/etc/cron.*
/var/spool/cron/crontabs/
Back those up, and you should have everything. You can do that with:
sudo tar cvf cron-backup.tar /etc/cron.* /var/spool/cron/crontabs
crontab -l > /path/to/your/backup/file
For example:
crontab -l > /var/backups/${USER}.crontab.list
<snide remark>
With another cronjob of course!</snide remark>
- in all seriousness though, good question. :)