Results 1 to 5 of 5
is there a way to recover the crontab file in linux? The root's crontab file was accidentally deleted off a server. The backups do not pick up that particular file. ...
- 02-27-2009 #1Just Joined!
- Join Date
- Apr 2007
- Posts
- 4
please help....crontab file blown away
is there a way to recover the crontab file in linux? The root's crontab file was accidentally deleted off a server. The backups do not pick up that particular file. I know the crontab kicked off some scripts, but now that the crontab file is gone I can't see which ones. Is there any way to recover, or any way to see the previous cron jobs that ran, so I can get an idea of how many things it was doing?
- 02-27-2009 #2Just Joined!
- Join Date
- Feb 2009
- Posts
- 45
The effectiveness of file recovery depends on the filesystem. Although EXT 2/3 filesystems should clean the part of the allocation tree that points to the blocks of the deleted file once a file is deleted, I recently overheard someone saying that in Linux this isnʼt actually done so there might still be hope in the case of EXT.
Originally Posted by wags1970
<OBSOLETE reason="This answer doesnʼt address the asked question">
Thatʼs what Iʼd do (in that order):
Originally Posted by wags1970
- Check, if «/var/log/cron.log» exists → exists? → … → profit!
- run «grep -R cron /var/log/*» → yields anything useful? → … → profit!
- Also check all compressed files in «/var/log» → … → profit?
- Check «/etc/syslog.conf» (or your equivalent) for where cron stores its log files → does cron log at all? → … → profit!
- Iʼm in Despair!
</OBSOLETE>
- 02-27-2009 #3Just Joined!
- Join Date
- Apr 2007
- Posts
- 4
I do see a lot of output in the /var/log/cron file, but I don't see what I'm looking for. One file I definitely know that ran at some point overnight each night was a .pl script. I know the name of it and it still exists on the system. How do I go about finding when it ran within the cron? One good thing I have going for me at this point is the server has not been rebooted, so its my understanding that when the crontab -r command was executed, it removed it from memory, but until the server reboots it will still be there. I want to leverage this is any way to help me re-create what was taking place in the crontab.
- 02-27-2009 #4Just Joined!
- Join Date
- Feb 2009
- Posts
- 45
I have to apologise, I misunderstood your question as to which file was lost. Iʼm sorry.
Originally Posted by wags1970
Iʼm afraid thatʼs not the case. I just checked the open file descriptors of my cron daemons (via «/proc/$PID/fd/») and did, just as expected, not find an open descriptor for any file, just stdin, stdout and stderr (which is redirected to the logfile). The only case which I could imagine, in which the file could have been preserved, is, if «malloc()» worked extremely in your favor and didnʼt reuse any memory already «free()»ed, that was previously used to store the crontab file; but thatʼs ridiculously improbable.
Originally Posted by wags1970
- 02-27-2009 #5Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
Many people recommend PhotoRec - CGSecurity to recover files that have been deleted.
Good luck ... cheers, drlWelcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )


Reply With Quote