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

}

#Done
print "Script finished\n";


--
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to