LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-14-2011, 01:19 AM   #1
narasimhasrkr
LQ Newbie
 
Registered: Mar 2011
Posts: 1

Rep: Reputation: 0
how to kill a process when its timeout


Hi everyone,

Hi i want to kill a process when timeout where 2 processes are running parallel or simultaneous in a same user witout effecting the another process,i have used the command
ps -ef |grep user
kill -9
but its killing another process suppose if i try to kill with processname sub processes in that process converting as daemon process and its not killing sub processes when killing parent process.

any help will be appriciate
 
Old 03-14-2011, 02:23 AM   #2
RedNeck-LQ
Member
 
Registered: Jan 2011
Posts: 83

Rep: Reputation: 11
I would try first with a soft kill. Note: PID is the process ID of the program.
kill PID

If that didn't worked, try the one below
kill -9 PID

The one below kills a process by the name of the running program rather than the PID.
pkill program


Quote:
Originally Posted by narasimhasrkr View Post
but its killing another process suppose if i try to kill with processname sub processes in that process converting as daemon process and its not killing sub processes when killing parent process.
Not sure I understand your meaning above, but try the code below. But before you run it, read what it does first.

pkill -P $( pgrep program_name )

This will kill a program's parent PID ( i.e the main program ) and it's child processes ( i.e other programs started by the main program ).

Replace program_name in bold with the name of the program or script you want to kill.

Remember, only the user who owns the process can kill the process. A user cannot kill another user's process. Only root can do that.

Last edited by RedNeck-LQ; 03-14-2011 at 03:29 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to kill or clean a Uninterruptible slept session leader process from process tabl golden_boy615 Linux - General 1 12-14-2010 11:47 AM
bash `kill`: process 'B' silently dies; but process 'A' = `kill` spews back debris! GrapefruiTgirl Programming 9 06-23-2009 10:42 AM
How to get the PID of the process giving kill signal to a process? hariprd Programming 2 11-27-2008 04:10 AM
Shell Script : Kill a running process when another process starts ashmew2 Linux - General 3 08-20-2008 04:47 AM
cannot kill process (kill -9 does not work) mazer13a Linux - General 1 05-27-2005 03:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:27 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration