6

this is a very specific question, I am sorry if there is a duplicate somewhere but I haven't been able to find it here or otherwise.

In a server I have a process in state T (Terminated). I know I could use kill -9 <pid> but in this case the process would end up as a zombie and my sysadmin would complain.

The program is obviously not doing anything but it's bit confusing as this particular process is very resource intensive so that we usually only start one instance. I am aware that the terminated one doesn't do anything but it would be nice to get rid of it. If it is not possible without the system restarting I will have to live with, no problem.

TIA ;)

  • 2
    Why not fix the program to do the right thing and die? – muru Dec 2 '15 at 9:23
  • 1
    Firstly, you need to sort out the bug in the procedure (unless there is a bug in the program itself), why is it in that state? did you stop it (with what)? do a strace like strace -p pid and see what the process is doing..there are other options too but need to get the idea from a lower level.. – heemayl Dec 2 '15 at 9:24
  • I get this: Process 49882 attached --- stopped by SIGTSTP --- --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=120022, si_uid=1001} --- rt_sigreturn() = -1 EINTR (Interrupted system call) wait4(-1, Yes, I terminated it with CTR+Z. It stays there in the wait loop for a while until I get: ^CProcess 49882 detached Thanks for the info. Getting rid of it is not a vital issue, I was just wondering if it was possible. Regards, E – runlevel0 Dec 2 '15 at 14:40
4

From your comment, you stopped the process with Ctrl-z (which is not the same as terminating).

If you want to kill the process, you have a few options

  1. Restore it to foreground and kill it.

Use these commands:

$ fg
Ctrl+c
  1. Kill it while stopped.

Just:

$ kill %
  1. For completeness-sake (although not specific to your question), you could also tell it to resume and work in background.

Commands:

$ bg   # for background
$ jobs # to see what is running in background (current shell)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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