LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 11-26-2008, 09:54 PM   #1
hariprd
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Rep: Reputation: 0
Question How to get the PID of the process giving kill signal to a process?


Hi,

I tried googling but didn't get any answer for this.

I have a process called "abc" and it is running with PID "123".
I have a putty session opened with PID "999".
I am giving kill -TERM 123 from putty session.
My process "abc" before dying it should catch the PID of the terminal which provided TERM signal to it.

Is there any way to find this out?
Your reply with sample pgms are really appreciated...

thanks in advance !

-HP
 
Old 11-27-2008, 12:31 AM   #2
raconteur
Member
 
Registered: Dec 2007
Location: Slightly left of center
Distribution: slackware
Posts: 276
Blog Entries: 2

Rep: Reputation: 44
Assuming your process abc is a C/C++ program you have created or have the source for, take a look at the man page for sigaction, it should get you pointed in the right direction.
Net searches for sigaction should also provide some examples.

Last edited by raconteur; 11-27-2008 at 12:33 AM. Reason: clarification/typo fix
 
Old 11-27-2008, 04:10 AM   #3
hariprd
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Smile

Excellant it works...

Thanks for the suggestion
 
  


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 a father process know which child process send the signal SIGCHLD icoming Programming 10 07-20-2010 08:26 AM
Shell Script : Kill a running process when another process starts ashmew2 Linux - General 3 08-20-2008 04:47 AM
how to signal a process from another process renjith.rv Linux - Newbie 3 04-23-2008 04:56 AM
Process not killed with -KILL (-9) signal hondo Linux - General 2 07-25-2007 10:23 AM
Looking for a way to find a PID and kill the process it belongs to johngreenwood Programming 6 01-14-2007 06:45 AM


All times are GMT -5. The time now is 10:58 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration