LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   HELP:Stopping execution of a program (https://www.linuxquestions.org/questions/programming-9/help-stopping-execution-of-a-program-423638/)

allomeen 03-10-2006 04:44 PM

HELP:Stopping execution of a program
 
Hello everyone,
I'm trying to stop a daemon process from a another program.

The program asks the user if they want to update, if yes the program must get a file (lets call it R1) from a giving location. and then stop the daemon(call it D1) and run R1. R1=D1 but D1 is a newer version.

Is there any idea how would I do that?.

scuzzman 03-10-2006 06:25 PM

You can just suspend or kill the process, can't you?

allomeen 03-10-2006 06:36 PM

I tried that using kill(pid_t, SIGSTOP) but I think this only works with the same process and its parent. So I tried to enter the pid manually of the program I'm going to kill, but nothing happens(no errors returned and program still running)

Any Ideas? Do you know if I can send a signal to another program, and if catched, i quit the program?

Alaa

scuzzman 03-10-2006 06:38 PM

You can make the other program put its pid in a file, then use this program to grab that pid and kill it. What language are you writing this in? What platform?

allomeen 03-10-2006 06:42 PM

I'm writing this program in C++ linux. This is not the problem; the problem that kill() only kills it itself, parent, or another process in its group (This what i think i got from the manual).


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