I am running on a python script on Putty using & at the end of the command. When I checked ps -p processid, it showed some name under TTY. After some time internet got disconnected. After connecting back, I check the process status using ps -p processid but this time I found '?' under TTY. Does this mean my script broke?
1 Answers
No, it only means that the TTY, which the script was started from, was closed in the meantime.
If you want to know more about the status, look into the STAT column:
It shows the status of the process. S stands for sleeping: the process is waiting for something to happen. Z stands for a zombied process. A zombied processes is one whose parent has died, leaving the child processes behind. This is not a good thing. D stands for a process that has entered an uninterruptible sleep. Often, these processes refuse to die even when passed a SIGKILL. You can read more about SIGKILL later in the next section on kill . W stands for paging. A dead process is marked with an X. A process marked T is traced, or stopped. R means that the process is runable.
source: http://www.slackbook.org/html/process-control-ps.html

- 12,375
- 12
- 51
- 73
-
1That means my script is still running and would produce results, right? Because I see TIME column getting incremented. – blackmamba Sep 02 '14 at 21:47
-
Correct. I updated my post with info about the STAT column. Also, you should be able to interact with the process with process control tools like `kill`. Unfortunately, you cannot foreground the process again, once the original shell was closed. – lxg Sep 02 '14 at 21:48
-
I have 'R' under STAT column. What does it mean when you say "Unfortunately, you cannot foreground the process again, once the original shell was closed."? – blackmamba Sep 02 '14 at 21:50
-
`R` means that the process is actively doing stuff, i.e. it's not a zombie, and it's not slepping either. I mentioned the “cannot foreground” thing in case you wondered if you could foreground the process with something like `fg`. – lxg Sep 02 '14 at 22:01
-
I see the script is still running because the resultant file size is incrementing. But when I check the process id using ps -p
, it is coming out to be blank. What does this indicate? – blackmamba Sep 03 '14 at 03:32 -
Hm, I don't know, could be several reasons. You could check with `ps ax | grep SCRIPT_NAME` if there's a process with your name. Otherwise, I'd suggest to start a new SO question, because it would be too complex to discuss in the comments. – lxg Sep 03 '14 at 07:36