in reply to Process ID of launched program?

Thank you, but that's not exactly what I am looking for. Actually, maybe it 'might' work with some changes. Basically, I want my Perl program to start another program (say a C program that I wrote). I want to get the pid of the program (without doing something cheesy like using ps and grepping for the prog name). The whole point is that I want to write a Perl program that launches programs and moniters how much CPU utilization the program is using. If the program is using too much of the CPU my perl program will renice() it. If the system load is still to high I'll pause my program and have the perl prog restart it when the load lightens up. Heck, this would be a good code kluge to give slash-dotted sights :-)

Replies are listed 'Best First'.
Re^2: Process ID of launched program?
by Anonymous Monk on Dec 21, 2004 at 10:59 UTC
    This is exactly I want to do using perl. Can i do something like this in perl (this will work in C shell) - ./a.out & echo $! > /tmp/pid_file; thanks !!