-1

This question already has an answer here:

I made a very serious mistake. I was editing the crontab file of my remote server, I was as the root user and it turns out that I wrote crontab -r instead of crontab -e and without previous notice it was simply deleted.

I was looking for information and it turns out that files deleted with the crontab -r command are not stored somewhere like the recycle bin or something similar. I am very worried because there are scheduled backups and all the scripts that my hosting placed. I already communicate with them and I must wait for a response from a specialized person in a period of 24 to 48 hours, but I am very concerned. Will it be possible to recover that file?

marked as duplicate by muru, Michael Homer, X Tian, Rui F Ribeiro, Kiwy May 20 at 11:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I did not understand you. – JulianProg May 20 at 3:48
2

You will not be able to recover the file unless you have a backup to restore it from.

For the future, I would recommend a sequence of operations like this

vi ~/.crontab              # Edit a local file
crontab ~/.crontab         # Set this file as your crontab file

If you get into the habit of only ever editing the copy and not the installed version you will always have a get-out in the event that you accidentally corrupt the copy:

crontab -l > ~/.crontab    # Create the local file as a copy of your crontab
0

In order to recover a file, please use extundelete tool from link http://extundelete.sourceforge.net/

  • You might want to point out that it's really important the extundelete tool is not installed onto the partition that held the deleted file. – roaima May 20 at 10:08

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