Multiple terminals launched from the command line, how to?

Asked by shaggy_surfer

I am trying to script and automate my shell login process and want to be able to launch multiple tabs within the same window like in gnome-terminal, in gnome-terminal you can use a --tab or --tab-with-profile to open a new tab and on top of that you can call a --command to the tab and have it execute a command. I am using this to call individual shell scripts that use "expect" to automate my login process. The problem that I ran into in gnome terminal is that it doesn't seem to be able to handle more than 10 simultaneous tabs at one time on the command line. Here is an example of what I use:

#!/bin/bash

#Define Variables for individual scripts to be passed as arguements to the gnome-terminal command for opening up a single window w/ many tabs.
HOST1="ssh_expect_web001-ec2002.sh"
HOST2="ssh_expect_app002-ec2002.sh"
HOST3="ssh_expect_queue001-ec2002.sh"
HOST4="ssh_expect_queue002-ec2002.sh"
HOST5="ssh_expect_queue003-ec2002.sh"
HOST6="ssh_expect_queue004-ec2002.sh"
HOST7="ssh_expect_queue005-ec2002.sh"
HOST8="ssh_expect_queue006-ec2002.sh"
HOST9="ssh_expect_queue007-ec2002.sh"
HOST10="ssh_expect_queue008-ec2002.sh"
HOST11="ssh_expect_queue009-ec2002.sh"
HOST12="ssh_expect_queue010-ec2002.sh"
HOST13="ssh_expect_queue011-ec2002.sh"
HOST14="ssh_expect_queue012-ec2002.sh"
HOST15="ssh_expect_queue013-ec2002.sh"
HOST16="ssh_expect_queue014-ec2002.sh"
HOST17="ssh_expect_queue015-ec2002.sh"
HOST18="ssh_expect_queue016-ec2002.sh"
HOST19="ssh_expect_queue017-ec2002.sh"
HOST20="ssh_expect_queue018-ec2002.sh"
HOST21="ssh_expect_queue019-ec2002.sh"
HOST22="ssh_expect_queue020-ec2002.sh"
HOST23="ssh_expect_queue021-ec2002.sh"
HOST24="ssh_expect_queue022-ec2002.sh"
HOST25="ssh_expect_conv001-ec2002.sh"

#Actual command string run as one command to open up all shells in a single window with multiple tabs
gnome-terminal --tab-with-profile=yellow --command ./$HOST1 --tab-with-profile=orange --command ./$HOST2 \
gnome-terminal --tab-with-profile=green --command ./$HOST3 --tab-with-profile=red --command ./$HOST4 \
gnome-terminal --tab-with-profile=blue --command ./$HOST5 --tab-with-profile=teal --command ./$HOST6 \
gnome-terminal --tab-with-profile=yellow --command ./$HOST7 --tab-with-profile=orange --command ./$HOST8 \
gnome-terminal --tab-with-profile=green --command ./$HOST9 --tab-with-profile=red --command ./$HOST10 \
sleep 3

echo "First group of 10 complete......"
sleep 5

#Looks like we need to split them into groups of 10, doesn't seem it executes more than that
gnome-terminal --tab-with-profile=blue --command ./$HOST11 --tab-with-profile=teal --command ./$HOST12 \
gnome-terminal --tab-with-profile=yellow --command ./$HOST13 --tab-with-profile=orange --command ./$HOST14 \
gnome-terminal --tab-with-profile=green --command ./$HOST15 --tab-with-profile=red --command ./$HOST16 \
gnome-terminal --tab-with-profile=blue --command ./$HOST17 --tab-with-profile=teal --command ./$HOST18 \
gnome-terminal --tab-with-profile=yellow --command ./$HOST19 --tab-with-profile=orange --command ./$HOST20 \
sleep 3

echo "Second group of 10 complete......"

The thing is that this gnome-terminal documentation is poor. It claims in the gnome-terminal --help that you can connect a tab to the last opened window, but what I have found is that everytime you execute the command more than once using the tabs as flags, ex. gnome-terminal --tab --tab --tab , it opens a new window with in this example 3 tabs. If you execute the command again, it will open a new window with 3 more tabs, it doesn't connect the new 3 tabs to the existing previously opened terminal with the 3 tabs that was already opened. My goal is to open many tabs (example 50) at a time and automate the login process. Some people say to use keys, the problem is, I am using a key pair and a username and pass that talks to a ldap auth server (this is for PCI compliance.), so it is more complicated than that. Thus the reason for individual shell scripts. It would be nice if you had a command line flag that you could execute the tab with and then tie in the --command flag along with that tab so that the shell is executed within that tab'd terminal. I tried using SCREEN, but this is not as nice as it is harder to shift between windows quickly. I like the ctl + pgup, ctl + pgdown in the gnome-terminal as it is fast and I can execute and copy and paste commands very quickly this way and move back and forth between windows faster to view logs and output. There was another program called Multi Gnome Terminal but they stated that Ubuntu has stopped including it prior to hardy. I am using hardy and intrepid. To compile it from what I read is a pain, and I tried it quickly but it failed. I don't think I want to use a product that isn't included in the distro anymore. There were several bugs opened on launchpad regarding how gnome-terminal opens tabs, but the dev guys said that it isn't a bug and that the documentation is not clear. But the way it is working is how it is supposed to work, which is when you run the command it opens a new window for each command run. You cannot execute another command instance and expect the tabs to be opened in the previous window.

Let me know if and when you guys are planning to implement a command line flag that can execute more than 10 shells with the --command flag at a time. It would be really nice.

I spent about 7 hours working on trying to find a solution under linux in gnome. I would really like to find an elegant solution, unfortunately I couldn't seem to find an answer on google. I used to use a program in windows called SecureCRT, and it was nice, but I would never go back to windows and they don't offer a version for linux. You can get it to run under wine and supposedly it's more stable, but that to me is a crappy way to do things. We should be able to use the native linux terminal programs to do this.

Thanks.

shaggy_surfer

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu terminator Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Craig Huffstetler (xq) said :
#1

http://sourceforge.net/projects/materm/

Mrxvt is an excellent one, based off of multiterm, aterm, and rxvt.

Have you also already tried XTerm or ETerm?

I use eTerm and have used Mrxvt and am almost completely positive both have reached above the "10 tab limit" you are speaking about.

Revision history for this message
Craig Huffstetler (xq) said :
#2

However, I'll let the gnome-terminal team answer your question concerning the command-line flag to execute more than 10 shells at once. I am pretty sure raster, though, documented how to do so with eTerm and if not you can always ask in #e on how to do so.

C

Revision history for this message
shaggy_surfer (shaggy-surfer) said :
#3

Thanks so much craig for such a quick reply. i will definately check out the eTerm and Xterm solutions you suggested. Do you know if Terminator actually plans on implementing this, it would be awesome to be able to automate the process.

Shaggy

Revision history for this message
Chris Jones (cmsj) said :
#4

I'm a little confused if this is about Terminator or GNOME Terminal....

I can speak for Terminator and say that we do have plans for the ability to load complex profiles. We've not thoroughly considered the possibilities of doing this from the command line, but we are certainly working towards the ability to restore saved layouts/profiles.

Revision history for this message
Craig Huffstetler (xq) said :
#5

The great thing about Eterm is the documentation:
http://www.eterm.org/docs/
+ The mailing list
+ The #e channel (they are very helpful)
+ If all else fails, the main developer will even help you!

I would hope for Gnome-Terminal, and for Konsole, and the main "GUI terminals" that are included in Ubuntu/Kubuntu that they do not make it as hard as scripting as you have pointed out. It would be my hope that they bring this to the forefront and put this in the hands of the user via the "Profiles" feature (and in this case, this would be your Default profile).

I don't know where Terminator came in? Is this about gnome-terminal or Terminator? Is Terminator:
http://software.jessies.org/terminator/

If so, I'm sorry but I have never used it. If this is about gnome-terminal, Eterm, xterm, or Mrxvt I can help you.

Revision history for this message
Craig Huffstetler (xq) said :
#6

If you do download Eterm just read the file README.Escreen and it will tell you what you are attempting to achieve in a very straight-forward fashion.

Revision history for this message
Craig Huffstetler (xq) said :
#7

As a note that may help you Escreen "merges" Eterm with screen. man screen will give you all the information to setup your information, like you want to do above, if you do choose to try out Eterm. You can just edit your .screenrc and you should be all set for the tab profile information.

Let me know if you have any other questions about other terminal emulators.

Revision history for this message
shaggy_surfer (shaggy-surfer) said :
#8

Sorry about the confusion Craig,

In response to you, the question originally was just about finding a solution, but the way that I found out about posting here was a link that I found on the terminator website that pointed here for asking questions under launchpad. It looks like the dev team at terminator created a launchpad link with faq's and that's how and why I signed up initially. This is for all of ubuntu right? If so , even better.

Thanks for all your suggestions, you have been very helpful.

Shaggy

Revision history for this message
Craig Huffstetler (xq) said :
#9

Yep, it was just filed under "gnome-terminal." Just Terminator. My bad.

Good luck. Maybe someone from the terminator term will be able to assist you. In the meantime, I understand your frustration and do know some terminal emulators *do* support what you are trying to do.

Let me know if you need more help on their fronts. Moving this over to terminator.

Can you help with this problem?

Provide an answer of your own, or ask shaggy_surfer for more information if necessary.

To post a message you must log in.