Automate an application using scripting, managing multiple terminals


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Automate an application using scripting, managing multiple terminals
# 1  
Old 07-16-2013
Automate an application using scripting, managing multiple terminals

Hi

I am new to Ubuntu and Bash scripting. I am working on a project to give a demo on an SDN application to my class. I need some help in scripting to create the demo. Please help in case if you have any idea on what am asking.

The demo uses a tool called mininet. I need just one script so that I can automate the whole of my demo.

The commands I need to run are given in order below.

1. Run "sudo mn" on the terminal. This changes the prompt from

/mininet$ sudo mn

to

mininet>

2. Now on this terminal where the prompt is 'mininet>' , I need to run "xterm h1" followed by "xterm h2" to create separate terminals for two hosts created by mininet.

3. I have to access the xterm terminal for h1 and run a command there . eg: ifconfig

4. I have to access the xterm terminal for h2 and run a command there . eg : set ip address

5. I have to run a ping in xterm terminal for h1 and while this is happening, i want to access terminals of h2 and start a ping in xterm terminals of h2.

6. I have to go back to the previous terminal from where the xterm terminals were spawned. 'mininet>' prompt one. and run "exit" and then when the promp goes back to normal '/mininet$' i have to "sudo mn -c" .


All of this should be done from one script. Please ignore the specific command mentioned and give a generic solution or clues.
# 2  
Old 07-16-2013
Have you tried expect ? It supports multiple spawning multiple sessions and send commands to them.
# 3  
Old 07-16-2013
While often abused/overused, I agree, the expect tool sounds like the tool for the job here.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automate multiple commands

Hi, I am trying to count the number of times a string of letters occurs in a file for multiple unique strings of letters. Right now I can do this one at a time using the following code (in this example I am searching for the string "AAA"): echo AAA >> outfile.txt grep -c "AAA" -r... (4 Replies)
Discussion started by: gecko1
4 Replies

2. Shell Programming and Scripting

Bash Scripting Help to automate replacing multiple lines

Background: I am writing a script to help me automate tweaks and things I apply to a custom Android rom I developed. I am on the very last part of my script, and I am stuck trying to find the right command to do what I seek. When I build roms from source, a file called updater-script is... (8 Replies)
Discussion started by: Silverlink34
8 Replies

3. AIX

How to open multiple virtual terminals to a single LPAR

I just wondering if there are ways to open multiple virtual terminal to a single LPAR. After I have use putty to login to the VIOS. I will use mkvt -id <LPAR id> to open console but if my friend want to open 2 second one, it will say, VT already connected. IS there a way to work this around ? ... (1 Reply)
Discussion started by: wingcross
1 Replies

4. Programming

Handling Multiple terminals

Hi, Basically I've written a game in ncurses that supports multiple players. Each player has a process associated with him which shares a segment of memory in which the player's structures are stored, and these structured are accessed by the 'server' program and handled there. The scope of the... (13 Replies)
Discussion started by: dgre0018
13 Replies

5. Shell Programming and Scripting

running Multiple terminals/shells

Hi, I'm looking for a way to send commands through multiple shells/terminals (not sure which is proper syntax). Basically, I have to open 3 different shells/terminals and run separate parts of a program suite in each of them. I find this annoying. The commands I have to do are simple, and could... (1 Reply)
Discussion started by: Caradoc
1 Replies

6. OS X (Apple)

Terminal scripting to automate login to cisco devices. Help Please !

Hello, I am new to the mac world, and would like to automate my login to cisco devices (routers, switches etc...), i am in a need of writing a script that i may just click on an icon on the desktop and it will open terminal and run a few command. as follow: telnet to an ip address type... (2 Replies)
Discussion started by: drdread
2 Replies

7. Shell Programming and Scripting

Managing dynamically multiple shell

I want to launch some shell scripts. I would have the possibility to change the number of shell scripts launched dynamically by modifying a variable, or a configuration file. For example, I start to launch 4 scripts at the same time, and after that, by modifying a variable, 6 scripts are... (0 Replies)
Discussion started by: gonzo38
0 Replies

8. Shell Programming and Scripting

calling multiple terminals

I'd like to write a script that will call n number of terminals that will all ssh to X-server and automatically enter the same password. Unfortunately I'm not exactly sure what kind of commands would work for me here because when I call for gnome-terminal, a new terminal pops up and the old... (1 Reply)
Discussion started by: gelitini
1 Replies

9. UNIX for Advanced & Expert Users

Multiple Terminals

Dear Members, I have aquired a load of old Wyse dumb terminals. I have a Linux system set up that I want to be the host for all of these. Now, I know these don't use cat5 or standard networking. They are all done through serial (com) ports. However, I researched this more and found a converter... (25 Replies)
Discussion started by: Phobos
25 Replies
Login or Register to Ask a Question