Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

executing three processes from three shells

Status
Not open for further replies.

subash707

Programmer
Jul 6, 2005
1
US
Hi everyone,

I have a problem. I have written a perl program which tries to run three processes in the system. I want the three processes to run in separate shells so that one can use the output of the other. But when I run my program, the first process runs and goes on running and the other two processes never run. My perl script is:

#!/usr/bin/perl -w

system("java net.tinyos.sf.SerialForwarder -comm network\@127.0.0.1:23");

system("java net.tinyos.oscope.oscilloscope");

system("java avrora.Main Blink.od");

When these processes are run differently in different shells one after the other, they work perfectly fine. But when I try to run them froma single perl program, the first one goes on running and the other two never get chance to run.

Can anyone tell me how I can run these three processes on three different shells from withing a single perl script?

Thank you so much,
Subash
 
you probably want to look at using fork() instead of system().
 
I wonder what different shell has to do with a process that runs at the background the same time as someothers.

Anyway try this

Code:
#!/usr/bin/perl -w

system("java net.tinyos.sf.SerialForwarder -comm network\@127.0.0.1:23 &");

system("java net.tinyos.oscope.oscilloscope &");

system("java avrora.Main Blink.od &");

exit 0;


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Could these programs use the output of the others in this way?

prog1 | prog2 | prog3

Mike

I am not inscrutable. [orientalbow]

Want great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top