Click here to Skip to main content
12,302,764 members (72,071 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C Ubuntu GCC
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 2-Sep-12 21:01pm
Edited 2-Sep-12 21:04pm
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

See the kill(3)[^] man pages for details of how to kill a process.
  Permalink  
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.
   
All right, a 5.
—SA
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160530.1 | Last Updated 3 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100