Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
1  
<snide remark> With another cronjob of course! </snide remark> - in all seriousness though, good question. :) –  jrg Feb 24 '12 at 1:25

2 Answers 2

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
share|improve this answer

crontab -l > /path/to/your/backup/file

For example:

crontab -l > /var/backups/${USER}.crontab.list

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.