On 08-Feb-08 10:53:59, Dan Hatton wrote:
Dear All,
I foolishly rm'd a file that a lengthy process still has open for writing (although it has yet to write any data.) That is, the output of lsof -p 26733 includes
gnuplot 26733 dan 4w REG 253,0 0 6802530 /home/dan/Natural_Sciences/mushy/twentyfirstplot.dat (deleted)
It would be really valuable to be able to save the data that process 26733 eventually writes to this file. Any ideas, please?
Thanks,
Dan Hatton
Not speaking authoritatively here, but it might just work! I just experimented with a 'vim' session, opening a new file:
vim temp.txt I entered the text "this is line 1", and saved it (:w).
Then, in another window, I deleted temp.txt and .temp.txt.swp, thus removing vim's "workspace" from the directory.
Then, back in vim, I entered another line "this is line 2" and again saved with :w
I find that temp.txt contains both lines (though .temp.txt.swp is now nowhere to be seen). And I can continue adding lines recreating temp.txt each time.
However, it may well be that whenever vim receives a ":w" it opens the file for writing, writes everything to it, and closes it again. So the above experiment proves nothing.
But when I identify the pid of the vim session (4636) and do as you did:
lsof -p 4636
the last line of the output is:
vim 4636 ted 3u REG 3,1 12288 294883 /home/ted/.temp.txt.swp (deleted)
very similar to yours. So I guess it depends on how gnuplot handles its open files. It could be that once the file is deleted, its internal file handle no longer points to anything, so nothing would happen (except maybe gnuplot would exit).
Good luck! (And I hope someone else really knows the answer). Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 08-Feb-08 Time: 11:26:04 ------------------------------ XFMail ------------------------------