Use gnome-terminal to automate (Fedora)

Suppose you have to run many applications on terminal (lets say gnome-terminal) and you want to automate this process, You can use command lines options of gnome-terminal.
Example
#gnome-terminal --geometry=80x20+700+0 --title=ping -x ping google.com &
where geometry will decide what will be length and width of your terminal and what will be the position of your terminal.
title sets the title of the terminal
-x is for the command to run
& to run this as background process.
(See man pages of gnome-terminal for more options, you can have tabs and many more options)

Now lets say we want to run following applications viz
1) my server lets say the name is /home/xyz/myServer.exe
2) tail -f /var/log/messages to see the log
3) ping google.com
4) ssh to some remote machine lets say xx.yy.zz.aa

So I will make a script say
automate.sh with following
#cat automate.sh
gnome-terminal --geometry=80x20+0+0 --title=myServer -x ./home/xyz/myServer.exe &
gnome-terminal --geometry=80x20+0+400 --title=logMessages -x tail -f /var/log/messages &
gnome-terminal --geometry=80x20+700+400 --title=ping -x ping google.com &
gnome-terminal --geometry=80x20+700+0 --title=remoteMachine -x ssh root@xx.yy.zz.aa &

Now you can run all the applications with a simple command
#sh automate.sh

Please remember that the opened window will close as soon as the command it is running stops executing, lets say the window/terminal running "tail -f /var/log/messages" will immediately go if you dont have permission to read /var/log/messages

No comments:

Books I like

  • Inside C++ Object Model
  • Unix Network Programming - Stevens
  • Professional-c++-programmer-to-programmer - wrox
  • Beautiful-code-leading-programmers-explain-how-they-think-theory-in-practice