Skip to content

Instantly share code, notes, and snippets.

@aterreno
Created June 28, 2011 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aterreno/1050805 to your computer and use it in GitHub Desktop.
Save aterreno/1050805 to your computer and use it in GitHub Desktop.
ssh into hadoop cluster
-- 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