Since upgrading my user's crontab has been wiped out. This is not the first time this has happened this year and it's a pain restoring it each time.
I'd like to be able to back up the crontab for my user but for that I need to know where it's stored.
Best Answer
Actually, it's not recommended to handle those files by hand. Per
crontab
man page:Files under
/var/spool
are considered temporary/working, that's why they probably get deleted during an upgrade, though a closer look at thecron
package's upgrade scripts may shed some light on this.Anyway, it's always a good practice to back up your cron entries or keep them in a file in your home directory.
I assume you're using
crontab -e
to create crontab files on the fly. If so, you can get a "copy" of your crontab file by doingcrontab -l
. Pipe that to a file to get a "backup":Then you can edit that my-crontab file to add or modify entries, and then "install" it by giving it to crontab:
This does the same syntax checking as
crontab -e
.