LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to send user defined signal in linux (https://www.linuxquestions.org/questions/linux-software-2/how-to-send-user-defined-signal-in-linux-232182/)

feetyouwell 09-18-2004 12:33 PM

how to send user defined signal in linux
 
how to send signal to a certain process, i know one way is though the keyboard, are there any other way such as writting a program that contains some sorta of send_sig function???

mirradric 09-18-2004 12:38 PM

have you tried
Code:

man signal
man kill

kill is section 2 btw

BluePyre 09-18-2004 12:53 PM

kill -s (signal) pid

To get a list of signals which you can send to a program:
kill -l

I am a little confused about your question. Is it possible to write a program that has some send_sig function? Of course it is! Here's a python example:
Code:

#!/usr/bin/python
import os

def send_sig(signal, pid):
  command = "kill -s"
  command += signal
  command += pid
  os.system(command)

send_sig("SIGKILL", 2420)


feetyouwell 09-18-2004 12:54 PM

yeah i read through those, but it's not what I wanted

I want to be able to send a user defined-signal to a group leader, which in term it will pass "my" signal down to all of its children. So far everything I read is about how to catch the signal, the only thing that tells me about sending is through keyboard, or kill(), raise(), <-- but these are not user-defined though.

feetyouwell 09-18-2004 12:57 PM

sorry man, my bad, i see what you mean now

feetyouwell 09-18-2004 12:59 PM

thanks guys, I just got a little confused on myself, thanks for the help, i think I got it now

Micky_123 12-26-2007 04:40 AM

How to send user defined signals in linux using C.
 
Hi ,
I am also looking answer for the same question.
How to send user defined signals in linux using C.
I believe you already got the answer for this, so can you please share the same.


All times are GMT -5. The time now is 09:27 PM.