LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Process killing... (https://www.linuxquestions.org/questions/linux-server-73/process-killing-914879/)

hhh123 11-22-2011 04:29 AM

Process killing...
 
I have two question,

1) How do I kill a remote login session without killing process started inside it?

2) Is there a way to kill a zombie process or process in the "D" state with the parent ID of 1 without a reboot?

Thank you.

unSpawn 11-22-2011 04:38 AM

1) use 'screen' for starting processes next time. Also see 'man bash' ("background process", 'disown'), 'man nohup; man at'.
2) Should be reaped by /sbin/init in due time. Only worry if there's many zombies or if they remain undead for prolonged period of time.

tollingalong 11-22-2011 03:59 PM

If you're trying to run a remote process and leave the process running after logout, look into nohup.

hhh123 11-22-2011 11:42 PM

Quote:

Originally Posted by unSpawn (Post 4530558)
1) use 'screen' for starting processes next time. Also see 'man bash' ("background process", 'disown'), 'man nohup; man at'.
2) Should be reaped by /sbin/init in due time. Only worry if there's many zombies or if they remain undead for prolonged period of time.

Heyy unSpawn, Thanks for your reply. for my 1st question your solution will work when user running there process under screen section, but in mine case i have a development server where all developer/ppl login thru ssh and try do some R&D and run there own process...and sometime they required to run process for a night but not a ssh session.And sometime due to poor programming skill...some process goes in zombie mode and in such case i need to find them i kill it manually,but most of the time it won't be kill by system even you use "kill -9" .

unSpawn 11-23-2011 05:50 AM

Quote:

Originally Posted by hhh123 (Post 4531292)
your solution will work when user running there process under screen section, but in mine case i have a development server where all developer/ppl login thru ssh and try do some R&D and run there own process...and sometime they required to run process for a night but not a ssh session.

I actually listed a three ways: if you don't want or can use 'screen': 0) backgrounding a process in the shell (also see 'man bash': "disown"), 1) using 'nohup' and finally 2) handing off processes to the 'at' service ...but only if you read carefully of course.


Quote:

Originally Posted by hhh123 (Post 4531292)
And sometime due to poor programming skill...some process goes in zombie mode and in such case i need to find them i kill it manually,but most of the time it won't be kill by system even you use "kill -9" .

Best solution: write better code. (Depending on what you're programming and availability of required resources maybe use virtualization to test before submitting jobs that may jeopardize the R&D machine?) IIGC you should "kill -20" the parent to see if it reaps the child itself. Else don't "kill -9" the zombie but "kill -9" its parent because doing that makes /sbin/init inherit the child to look after. If init is already the PPID then you sould just wait as zombies are only entries in the process table that take up no resources (http://en.wikipedia.org/wiki/Zombie_process). AFAIK reasons for rebooting could be processes in the uninterruptible sleep state (http://en.wikipedia.org/wiki/Uninter...ruptible_sleep) for which you have determined resources have gone or never will become available, having a huge amount of zombies that over time refuse to be reaped or zombies from which resources can't be reclaimed somehow.


All times are GMT -5. The time now is 11:40 PM.