Created
June 28, 2011 09:30
-
-
Save aterreno/1050805 to your computer and use it in GitHub Desktop.
ssh into hadoop cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Launch iTerm and log into multiple servers using SSH | |
tell application "iTerm" | |
activate | |
-- Read serverlist from file path below | |
set Servers to paragraphs of (do shell script "/bin/cat $HOME/Serverslist") | |
repeat with nextLine in Servers | |
-- If line into file is not empty (blank line) do the rest | |
if length of nextLine is greater than 0 then | |
set server to "nextLine" | |
set term to (current terminal) | |
-- Open a new tab | |
tell term | |
launch session "Default Session" | |
tell the last session | |
write text "ssh deploy@" & nextLine | |
-- sleep to prevent errors if we spawn too fast | |
do shell script "/bin/sleep 0.01" | |
end tell | |
end tell | |
end if | |
end repeat | |
-- Close the first tab since we do not need it | |
terminate the first session of the current terminal | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment