-   Linux - Newbie (
-   -   Execute programs in multiple terminals using a Shell Script (

kapz_unlocked 09-04-2011 01:34 AM

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

timothyb89 09-04-2011 03:35 AM

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


program1 >> program1.log 2>&1 &
program2 >> program2.log 2>&1 &
program2 >> program3.log 2>&1 &

Then in separate terminals:

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:


konsole --noclose -e program1 &
konsole --noclose -e program2 &
konsole --noclose -e program3 &

kapz_unlocked 09-04-2011 03:55 AM

Thanks timothy! But I solved the problem using 'gnome-terminal':


#! /bin/bash

cd /root/ESSR_log/JavaRun

gnome-terminal -e "java ServerInputChunks"

gnome-terminal -e "java GetRequestedFiles"

gnome-terminal -e "java ServerDeleteRequest"
This is what I exactly needed :)

All times are GMT -5. The time now is 01:08 PM.