I have removed my crontab. How can I recover it?

I made a mistake by issuing the crontab - r command and the crontab was removed. Now, when I type crontab -l it is showing no crontab for root.

Can anyone please help me to restore the crontab?

2

1 Answer

If you have no /var/log/syslog file, you can recover the commands (but not the timings) from the syslog file.

use:grep 'CRON' /var/log/syslog

you can then figure out the timings by looking at the date-stamps.

Credits: Recover cron jobs accidently removed with crontab -r

PS: To avoid such problems in the funture, try to add a cron to backup your crontab everyday.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like