Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: 15
How to stop a process immediately

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
Registered: May 2001
Posts: 29,353
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
Unless it ignores TSTP: SIGSTOP / SIGCONT?
Old 08-09-2012, 05:33 PM   #3
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 3,441

Rep: Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508
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.)


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

All times are GMT -5. The time now is 08:20 AM.

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