Friday, August 15, 2014

Ubuntu tasks in separate terminals

On my current project I need to open few terminals (5 and more) and start different processes. For example, I need to open terminal, change current dir, start ruby application. On second terminal I open virtual env start python script etc...

I had a problem also with finding right terminal window when I needed.
So I created scripts that open all my terminals and give them appropriate names

terminal1.sh :

#!/bin/bash
source '/home/dev/.bashrc'
echo -ne '\033]0;Web server\007'
cd '/home/dev/src/proj1'
source '/home/dev/src/venv/bin/activate'
bash /home/dev/src/proj1/start_web_server.sh


To start all terminals I neede one more script

#!/bin/bash

gnome-terminal --window-with-profile=dev --working-directory='/home/dev/' -e 'bash --rcfile /home/dev/scripts/terminal1.sh'
gnome-terminal --window-with-profile=dev --working-directory='/home/dev/' -e 'bash --rcfile /home/dev/scripts/terminal2.sh'
gnome-terminal --window-with-profile=dev --working-directory='/home/dev/' -e 'bash --rcfile /home/dev/scripts/terminal3.sh'