LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-04-2011, 01:34 AM   #1
kapz_unlocked
LQ Newbie
 
Registered: Jun 2011
Distribution: CentOS 5.5
Posts: 11

Rep: Reputation: Disabled
Execute programs in multiple terminals using a Shell Script


Hello all,

I have three java programs to wait on three sockets. I want to write a Shell Script to execute all three at once in three different terminals. Making the backgroung won't help as I want to track the outputs of three programs separately.

Is this possible? Or is there any other way to do this?
Please help!
Thanks in advance
 
Old 09-04-2011, 03:35 AM   #2
timothyb89
Member
 
Registered: Jul 2006
Location: Colorado, USA
Distribution: openSuSE 11.4
Posts: 118

Rep: Reputation: 15
You could redirect the output of each to a file and monitor it with something like tail:

Code:
program1 >> program1.log 2>&1 &
program2 >> program2.log 2>&1 &
program2 >> program3.log 2>&1 &
Then in separate terminals:
Code:
tail -f programX.log
With that you can start them from a single terminal, and monitor them separately.

Alternatively you could have a script launch a new instance of your terminal emulator of choice for each program:

Code:
konsole --noclose -e program1 &
konsole --noclose -e program2 &
konsole --noclose -e program3 &
 
Old 09-04-2011, 03:55 AM   #3
kapz_unlocked
LQ Newbie
 
Registered: Jun 2011
Distribution: CentOS 5.5
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thanks timothy! But I solved the problem using 'gnome-terminal':

Quote:
#! /bin/bash

cd /root/ESSR_log/JavaRun

javac ServerInputChunks.java
gnome-terminal -e "java ServerInputChunks"

javac GetRequestedFiles.java
gnome-terminal -e "java GetRequestedFiles"

javac ServerDeleteRequest.java
gnome-terminal -e "java ServerDeleteRequest"
This is what I exactly needed
 
  


Reply

Tags
shell script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Source or Execute an external Script from shell script helptonewbie Linux - Newbie 2 08-11-2010 12:48 PM
script to execute a command multiple times snr8fl3 Programming 5 11-17-2008 12:49 PM
help with execute mulitple shell script within shell script ufmale Programming 6 09-13-2008 12:21 AM
script + multiple terminals jnusa Linux - Software 4 12-06-2004 07:11 AM
shell script how to execute x2000koh Programming 6 07-29-2003 04:20 PM


All times are GMT -5. The time now is 12:51 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration