Run script in new terminal


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Run script in new terminal
# 1  
Old 03-31-2015
Run script in new terminal

Hi Guys,

I have a script that runs certain simulations in batch mode. I need to schedule some simulations to run over night.
For each simulation to complete it should be run in separate terminal.

My script is as follows

sh run_test.sh <arg1> <arg2> <arg3> ...

I need to launch this command in a separate terminal so I use :

gnome-terminal --window -e "sh run_test.sh <arg1> <arg2> <arg3> ..."

I tried:
gnome-terminal --window -e "sh run_test.sh <arg1> <arg2> <arg3> ..."


But it does not work. The terminal is opened for a fraction of second then close immediately.

Kindly advise.

Thanks
# 2  
Old 03-31-2015
What is the difference between you opening a terminal and run that script, rather than executing the script in the current terminal?

Did you try passing the full path to the script?
Because if it happens to be not in the very same path, it will fail immediatly.

You could still make a file with your args, as:
Arg_File:
Code:
arg1 arg2 arg3
arg1 arg2 arg3 arg4
arg1 arg2
arg1 arg2 arg3
arg1 arg2 arg3 arg4
arg1 arg2

Then run something like:
Code:
while read line;do
   sh run_text.sh $line
done<Arg_File

hth
# 3  
Old 03-31-2015
You could run all those processes in the background from your current terminal. Don't forget to nohup or disown each of them, lest they're killed when you log off!
# 4  
Old 04-20-2015
Thanks guys.

I tried the xterm instead of terminal and it works. I do not know the reason why the gnome-terminal does not work.

---------- Post updated at 02:52 PM ---------- Previous update was at 02:49 PM ----------

Quote:
Originally Posted by sea
What is the difference between you opening a terminal and run that script, rather than executing the script in the current terminal?

Did you try passing the full path to the script?
Because if it happens to be not in the very same path, it will fail immediatly.

You could still make a file with your args, as:
Arg_File:
Code:
arg1 arg2 arg3
arg1 arg2 arg3 arg4
arg1 arg2
arg1 arg2 arg3
arg1 arg2 arg3 arg4
arg1 arg2

Then run something like:
Code:
while read line;do
   sh run_text.sh $line
done<Arg_File

hth

I have a list of simulations that I want to automate them running. Each simulation runs in individual terminal.
I can open a new terminal manually when I'm setting on the machine. But I want to automate the run of the test list over night.
# 5  
Old 04-20-2015
Check out screen

There are examples online, you should be able to run whatever you like multiple times, logging output and everything session spits out in a file (or not)

Hope that helps
Regards
Peasant.
# 6  
Old 04-20-2015
Quote:
Originally Posted by aelhosiny
Thanks guys.

I tried the xterm instead of terminal and it works. I do not know the reason why the gnome-terminal does not work.

---------- Post updated at 02:52 PM ---------- Previous update was at 02:49 PM ----------




I have a list of simulations that I want to automate them running. Each simulation runs in individual terminal.
I can open a new terminal manually when I'm setting on the machine. But I want to automate the run of the test list over night.
So simply send the command to background using a &.
Code:
...
    $SHELL run_text.sh $line &
...

Though that is not recomended if you have more than, lets say, 5-10 scripts/lines, you might bring that machine to its knees spwaning too many subshells.
Search the forum for paralell execution or background jobs, there are several good threads covering the topic with examples.

hth
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to run a shell script in background without showing in the terminal?

Hi Guys, i am having a script which checks for ip address is pingable or not,when i execute this script in terminal it keeps on showing the pinging status of every ip address and it takes more time when i check for 100 ip address,How to do run a script in background without showing in the terminal... (4 Replies)
Discussion started by: Meeran Rizvi
4 Replies

2. Shell Programming and Scripting

Open gnome-terminal with multi tabs and automatically run a script in each tab

Hi All , i am trying to create an alias to open a new gnome-terminal and run some commands in each tab & to have a specific name for each tab i am using csh , tried this command gnome-terminal --tab -t "s1" --tab -t "s2" --tab -t "s3" --tab -t "s4" it opened 4 tabs but the title didn't... (0 Replies)
Discussion started by: Assem
0 Replies

3. Shell Programming and Scripting

Problem run script inside a gnome-terminal

hi, I would like to ask about using gnome-terminal command, I had a script that will run my VBOX VM in headless and i want to display the output(STDOUT) on the gnome-terminal window. The purpose that i want to display the STDOUT of the script cause i will used it or create a desktop shortcut for... (11 Replies)
Discussion started by: jao_madn
11 Replies

4. Linux

How to open a gnome-terminal in specific workspace and run script within it automatically upon login

OK this is a bit messy. I run Fedora with gnome on a compiz desktop, I have a script (userstart) that opens my 'standard' environment for all my machines when I login. userstart flips to a specific workspace and then opens the required applications in that workspace then flips to the next... (2 Replies)
Discussion started by: Bashingaway
2 Replies

5. UNIX for Dummies Questions & Answers

Script to run a command in a new terminal

Hey, I am trying to write a script that will open all of my session windows, and then secure shell into the appropriate server in the new windows. Seems simple, but I cant get it to work! Please help! :confused: (1 Reply)
Discussion started by: sojo1024
1 Replies

6. Shell Programming and Scripting

Run bash script without terminal

How can I make a bash script that keeps on running after I have closed the terminal? Or a script that runs without having the terminal window open? (1 Reply)
Discussion started by: locoroco
1 Replies

7. UNIX for Dummies Questions & Answers

Script run everytime a new terminal window is opened

I created a script called title #!/bin/sh echo "^0;$*^G" It will change the terminal window titlebar to what ever I type after the script (title BIG would change titlebar to BIG instead of terminal) Is there a way to make it run so it will work on every terminal window that gets opened.... (1 Reply)
Discussion started by: amason0508
1 Replies

8. Shell Programming and Scripting

open terminal to run cmd using shell script

i want the shell script to open the terminal and in that terminal i want to run a command specified in the script... how can it be done... (2 Replies)
Discussion started by: chandrabhushan
2 Replies

9. Linux

run script through terminal

for all friends i am using linux enterprise 4. i installed oracle 10g in user name oracle.at the end of install i got a pop up window saying that u should run the following scripts(root.sh,orainstRoot.sh) in terminal from root account(cui) without log out oracle account . how i can run these... (5 Replies)
Discussion started by: sadiquep
5 Replies

10. UNIX for Dummies Questions & Answers

Run the start script from the terminal? Newbie Time!

Hi, How do I "run a script"? I'm trying to start up some software called ElectroServer 3, and was told I just needed to "run the start script from the terminal to get things going". From the terminal, i use cd command to change to the software's directory, and I guess the script in question is... (4 Replies)
Discussion started by: waking_bear
4 Replies
Login or Register to Ask a Question