LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-22-2011, 04:29 AM   #1
hhh123
Member
 
Registered: Jul 2009
Location: /
Distribution: centos
Posts: 47

Rep: Reputation: 1
Question 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.
 
Old 11-22-2011, 04:38 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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.
 
Old 11-22-2011, 03:59 PM   #3
tollingalong
Member
 
Registered: Nov 2011
Posts: 42

Rep: Reputation: Disabled
If you're trying to run a remote process and leave the process running after logout, look into nohup.
 
Old 11-22-2011, 11:42 PM   #4
hhh123
Member
 
Registered: Jul 2009
Location: /
Distribution: centos
Posts: 47

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by unSpawn View Post
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" .
 
Old 11-23-2011, 05:50 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by hhh123 View Post
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 View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
killng parent process without killing child process (Linux C programming) lettuce84@naver.com Linux - Newbie 3 07-24-2015 08:37 AM
Killing More than one process ruud Programming 11 04-27-2010 06:30 AM
Killing process by username mijohnst Linux - Software 4 05-30-2005 08:50 PM
Killing a process by its name rabeea Linux - Networking 3 03-17-2005 05:30 AM
Really Killing a Process! lazlow69 Linux - Newbie 14 05-10-2003 10:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration