Click here to Skip to main content
Rate this: bad
good
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 22:01pm
Edited 2-Sep-12 22: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 at 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 at 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 at 11-Jan-13 2:22am
   
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 at 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 at 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
0 Sergey Alexandrovich Kryukov 450
1 OriginalGriff 220
2 DamithSL 130
3 Dave Kreskowiak 120
4 Suvendu Shekhar Giri 110
0 OriginalGriff 7,645
1 DamithSL 5,614
2 Sergey Alexandrovich Kryukov 5,344
3 Maciej Los 4,961
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 3 Sep 2012
Copyright © CodeProject, 1999-2014
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