neonep
Programmer
- Jun 26, 2003
- 34
Hi everyone,
For various debugging tasks, I regularly need to log into 3 different servers and look at 2 different log files on each. It would be awesome to have a script that would open gnome-terminal with multiple tabs ssh'ed to different servers and cd each tab to a directory of my choosing. Does anyone have a script that can do this? I have public/private key authentication set up, so I don't have to enter any passwords.
-------
I found the following script 1 and came up with script 2. Both look promising but they have their flaws.
1.
konsole --script -e ssh user@server1 &
sleep 1
KONSOLE=`dcop | grep konsole | tail -n 1`
SESSION=`dcop $KONSOLE konsole newSession`
sleep 1
dcop $KONSOLE $SESSION sendSession "user@server2"
sleep 1
dcop $KONSOLE $SESSION sendSession "cd /some/folder"
I really don't understand this script although it logs into two servers and changes directories for one. How can I make it do the same for one more server?
2.
gnome-terminal --tab-with-profile=default -t server:log -e "ssh user@server1" --tab-with-profile=default -t server:log -e "ssh user@server2"
This logs into different servers but I don't know how to make it change directories.
-------------
Any help will be greatly appreciated.
Thanks.
For various debugging tasks, I regularly need to log into 3 different servers and look at 2 different log files on each. It would be awesome to have a script that would open gnome-terminal with multiple tabs ssh'ed to different servers and cd each tab to a directory of my choosing. Does anyone have a script that can do this? I have public/private key authentication set up, so I don't have to enter any passwords.
-------
I found the following script 1 and came up with script 2. Both look promising but they have their flaws.
1.
konsole --script -e ssh user@server1 &
sleep 1
KONSOLE=`dcop | grep konsole | tail -n 1`
SESSION=`dcop $KONSOLE konsole newSession`
sleep 1
dcop $KONSOLE $SESSION sendSession "user@server2"
sleep 1
dcop $KONSOLE $SESSION sendSession "cd /some/folder"
I really don't understand this script although it logs into two servers and changes directories for one. How can I make it do the same for one more server?
2.
gnome-terminal --tab-with-profile=default -t server:log -e "ssh user@server1" --tab-with-profile=default -t server:log -e "ssh user@server2"
This logs into different servers but I don't know how to make it change directories.
-------------
Any help will be greatly appreciated.
Thanks.