LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   shell terminated but process is still running (https://www.linuxquestions.org/questions/linux-newbie-8/shell-terminated-but-process-is-still-running-4175494457/)

sigint-ninja 02-10-2014 01:31 PM

shell terminated but process is still running
 
i was editing a file in vi and my internet connection
crashed...now when i try open the file it says that it was busy editing the file etc...and that the process is still running...how do i get back to that vi session the id is 56183...any ideas of what i can do? vi -r didnt work

thanks

anomie 02-10-2014 01:52 PM

(Assuming you're actually referring to 'vim' on a Linux system..)

Launch 'vi' (with no arguments), and try:
Code:

:recover file_name_here
Also, consider using 'GNU screen' or 'tmux' for your remote work, to avoid problems like this altogether.

SAbhi 02-10-2014 11:25 PM

the last work wasnt saved, am i right ?
then just kill that process and start over.

what died is just your terminal session but the instance is still running that's why the process is alive and kept holding the lock on the file.

rtmistler 02-11-2014 07:59 AM

Maybe the process is not running, because the parent (terminal) is gone; however maybe a temporary file of the type .<something> is there. I'm not a vim expert, but the later versions try to keep your last edit place on a file. And what I do know in a similar situation is if I have to force shutdown when I have a truecrypt volume mounted, it leaves a .truecrypt-lock-<myusername> file in my home; and when I boot back up I have to remove that file or it complains that truecrypt is already running. It really isn't, but the error says that because it sees the lock file. Therefore see if vim has some sort of lock file or a directory in your home containing something like that.

chrism01 02-11-2014 04:32 PM

You could try lsof to see exactly which file is open and try 'cat' ing that to a new temp file.
you may be able to recover most of it from there.
You can also check for eg a file called 'test.x' should have a backup (swp) file called '.test.x.swp' (note leading '.' .
You can see this using
Code:

ls -al
in the correct dir or as indicated by lsof above.
http://linux.die.net/man/8/lsof


All times are GMT -5. The time now is 06:33 PM.