LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 12: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, 02:49 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Unless it ignores TSTP: SIGSTOP / SIGCONT?
 
Old 08-09-2012, 05:33 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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



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 10:34 PM
Trying to stop Xwindows from immediately starting gothrog Linux - Newbie 3 06-07-2004 12:42 PM
how to stop a process? frostmagic Programming 14 12-05-2003 11:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:32 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
Open Source Consulting | Domain Registration