Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to do a complete server backup.

I already have my backup script copying all of the html/php files for the web app, and the mysql databases, placing them into a .tar.gz file.

How can I add the crontab files to that backup?

Whenever I save the crontab, it goes to /tmp folder.. and when I check that folder immediately afterwards, it is empty.

share|improve this question
Just a though, may versions of cron allow root to place the jobs in /etc/cron.d/, I generally prefer that instead, since my /etc folder is backed up, and tracked in a VCS. – Zoredache Nov 18 '11 at 8:46
With regard to your username, sorry to take away your '666' upvote count -but I found the post useful. ;) – a coder Sep 19 '13 at 15:30
up vote 13 down vote accepted

You could just backup the entire /var/spool/cron directory. It contains all crontabs of all users.

share|improve this answer
Worked a treat, thanks. – darkAsPitch Nov 28 '11 at 4:11

just backup the file /var/spool/cron/USER_NAME

share|improve this answer
For Ubuntu 14.04 at least, the relevant files are in the directory /var/spool/cron/crontabs. – Kenny Evitt Jan 22 '15 at 1:31
@KennyEvitt and you must be the root to access it sudo -i – Simone Apr 23 at 9:43

You can periodically run crontab -l > my_crontab.backup to backup the crontab into file.

share|improve this answer

Your Answer


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.