Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
i wanted to write a program that is able to kill one process by other process and sends a warning message to the end user that a process, say x, is closing another process, say y.I have no idea where to start so pls help.i wld appreciate if a get a reading or video material.By using an ubuntu terminal

best regards Mimi!!
Posted
Updated 2-Sep-12 21:04pm
v2

See the kill(3)[^] man pages for details of how to kill a process.
 
Share this answer
 
Comments
mimi from Unknown 3-Sep-12 7:45am    
tnx Richard.u know what i was thinking to do both kill the process and at the same time to send a read pipe to the killing process from the killed one.but i cld not understand pipes.and how to use them and how to use them together with kill.cld u plse help me????

best regards Mimi!!!
Richard MacCutchan 3-Sep-12 8:23am    
I'm sorry but I cannot provide a full tutorial on read pipes between processes, you need to do some reading for yourself. It is also quite difficult to figure out exactly what you are trying to do, beyond killing a process.
Sergey Alexandrovich Kryukov 11-Jan-13 2:22am    
All right, a 5.
—SA
You ask for a C solution.

I would solve it in a bash script using kill[^] and mail[^].

For programming in C, use kill[^] and fall back to the mail command line tool to send the notification (via system[^]).

See also wikipedia[^] for an overview on kill and wikipedia[^] on unix mail command line utility.

Cheers
Andi
 
Share this answer
 
v2
Comments
mimi from Unknown 5-Sep-12 4:03am    
Tnx Andi!!!in order to kill a process i need to input the process id of the process to be killed.is there a function that gets me yhe process id of another process in which these two processes are not related.

Best regards
Mimi
Andreas Gieriet 5-Sep-12 4:13am    
On the shell, there is ps.
I mean, the process to kill has to be selected somehow. Is it the user who selects from a list (by name?) or is it sufficient to tell the user to run the ps command on the shell and pass over the process id?
Cheers
Andi

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900