On 20 Feb 2008, at 22:33, David Meisner wrote:
> OK well here's my solution. And yes I realize this is a terrible
> TERRIBLE hack. But nothing else has worked so far.... Also this
> clearly won't work with another instance of dtrace running.
>
> #!/usr/bin/perl
>
> print "Welcome to the script\n";
>
>
> #Make sure DTrace isn't running
> `pkill dtrace`;
>
> my $pid = fork();
>
> if(not defined $pid){
>
> #fork failed
> print 'Fork failed on resources :(\n';
>
> }elsif ($pid==0) {
>
> #In child process
>
> print "Starting DTrace\n";
> exec('dtrace -s pageTrace.d > traceOut.txt');
>
> } else {
>
> #In parent process
>
> print "Waiting for DTrace to start\n";
>
> $dtraceRunning = 0;
> while(!$dtraceRunning){
> $dtraceRunning = `ps -A|grep dtrace`;
> sleep(1);
> }
>
> print $dtraceRunning."\n";
>
> print "Doing stuffn";
>
>
> #Stop the DTrace process
> `pkill dtrace`;
Why are you killing dtrace after it stopped running anyway? I
originally assumed you were trying to kill a dtrace script that didn't
terminate.
Can you clarify: do you want the Perl program to wait for dtrace to
terminate or not?
--
Andy Armstrong, Hexten
_______________________________________________
dtrace-discuss mailing list
[email protected]