LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-09-2012, 01:19 PM   #1
puntino
Member
 
Registered: Sep 2006
Location: Italy
Distribution: Suse 10.1
Posts: 78

Rep: Reputation: 15
How to stop a process immediately


Hello,
I'd like to know how to stop a process immediately after its creation.
What I have to do is to track all the system call invoked by a "monitored" process. The monitor needs the PID of the monitored process.
Some of you might say, start the monitored and provide to it the PID of the monitored process. Unfortunately,
it is not that easy (I'm using systemtap for monitoring, I don't know if u are familiar with it). The monitored can be started only after the PID is known. As an example, try to imagine that we want to monitor all the system calls invoked by the "top" command. My current workflow goes as follows:
start top
start monitor
collect data

Starting the monitor takes some time, in the meanwhile some calls are not logged. Therefore, I thought of doing something like this:

start top, pause it (immediately for some seconds)
start monitor
top resumes, the monitor is ready to collect data.

How do I pause a monitor for some seconds right after its creation (it shouldn't execute any instruction).
Thank you in advance
 
Old 08-09-2012, 03:49 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531
Unless it ignores TSTP: SIGSTOP / SIGCONT?
 
Old 08-09-2012, 06:33 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,968

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Perhaps you could write a simple wrapper that pauses for several seconds (or waits for some event) and then exec()s the program you want to monitor. You'll catch some extra stuff at the beginning, but shouldn't miss anything.

(No, I've never used systemtap, so perhaps this is totally wrong.)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get DBPedia References to stop crashing immediately after I start it? verynoobish Slackware 4 05-23-2011 11:34 PM
Trying to stop Xwindows from immediately starting gothrog Linux - Newbie 3 06-07-2004 01:42 PM
how to stop a process? frostmagic Programming 14 12-05-2003 12:02 PM


All times are GMT -5. The time now is 08:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration