Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: monitor process

by grashoper (Monk)
on Apr 24, 2009 at 15:14 UTC ( #759862=note: print w/replies, xml ) Need Help??


in reply to Re: monitor process
in thread monitor process

I am able to connect to my process when passing in the process id which I obtained from processinfo.pl..(idea is to grab the new process id and pass it in and then use it to monitor process so it keeps running continuously or something.. ) process info code followed by my process.pl code which is just to connect and tell me exit code as I don't really know yet how to do anything with it. stuff below code is ignorable.
use Win32::Process::Info; use Data::Dumper; $pi = Win32::Process::Info->new (); $pi->Set (elapsed_in_seconds => 0); # In clunks, not seconds. @pids = $pi->ListPids (); # Get all known PIDs @info = $pi->GetProcInfo (); # Get the max %subs = $pi->Subprocesses (); # Figure out subprocess relationships. @info = grep {$_->{Name} =~ m/vugen/} $pi->GetProcInfo (); # All processes with 'perl' in name. #print $info; #print $pi; my $href=\%subs; print Dumper $href; print Dumper @info; #print Dumper @pids;
use Win32::Process; use Win32; sub ErrorReport{ print Win32::FormatMessage( Win32::GetLastError() ); } Win32::Process::Open($Obj,$pid=12732,$iflags)|| die ErrorReport(); print "connected to process $pid "; $Obj->GetExitCode($exitcode); print $exitcode;
that sounds very much like what I want to do but how can I do it on a winblows system..(er I mean windows). I am looking at win32 process, but it's not clear how to export "still-active" I manage to get a bit over my head on this one,how do I explicitly export? so far I haven't gotten much, trying to figure out how to tell if still_active or setup a heartbeat or something. I can get it to launch but not to open my script.
use Win32::Process; use Win32; sub ErrorReport{ print Win32::FormatMessage( Win32::GetLastError() ); } Win32::Process::Create($ProcessObj, "C:\\program files\\Mercury\\LoadRunne +r\\bin\\vugen.exe", "E:\\Mibor_timingtest\\Mibor\\mibor.us +r", 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport(); Win32::Process::Open($Obj,$pid=11672,$iflags)|| die ErrorReport(); $ProcessObj->Suspend(); $ProcessObj->Resume(); $ProcessObj->Wait(INFINITE);
I am trying to figure this out has anyone used before? I get 259 as my exit code what does that mean?
use Win32::Process; use Win32; sub ErrorReport{ print Win32::FormatMessage( Win32::GetLastError() ); } Win32::Process::Open($Obj,$pid=11672,$iflags)|| die ErrorReport(); print "connected to process $pid"; #$ProcessObj->Suspend(); #$ProcessObj->Resume(); #$ProcessObj->Wait(INFINITE); $Obj->GetExitCode($exitcode); print $exitcode;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://759862]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2022-01-24 12:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (64 votes). Check out past polls.

    Notices?