I created run-in-tabs.sh which only works for the gnome-terminal. You can do similar stuff with iTerm or plain Terminal plus Applescript in OSX even though that is out of the scope of this post as I am trying to push the team to work with Desktops that are closer to the servers where the applications are hosted.
Suppose you have server1 accessible, server2 and server 3 accessible from server1 and server 4 only accessible from 3 and 2. It is not hard to find this kind of situations especially in environments where security must be put in place with scarce resources. What do you do?
- Download the script.
- Create wrappers for your SSH connections especially if they are multi-hop
- Include the commands in a file like billing-environment.txt
#billing-environment.txt #A simple direct ssh ssh -t user@server1 #Wrapped (for simplicity) ssh commands /home/nestor/ssh-billing-server2.sh /home/nestor/ssh-billing-server3.sh /home/nestor/ssh-billing-server4.sh #A complex direct ssh equivalent to /home/nestor/ssh-billing-server4.sh #ssh -t user@server1 \"ssh -t server2 \"ssh -t server4\"\"
Here is for example /home/nestor/ssh-billing-server4.sh:ssh -t user@server1 "ssh -t server2 \"ssh -t server4\""
- Run just one command and get the 4 tabs with an ssh session to a different server each:
$ ./run-in-tabs.sh billing-environment.txt
No comments:
Post a Comment