Skip to content

Instantly share code, notes, and snippets.

@braveulysses
Created March 14, 2011 22:33
Show Gist options
  • Save braveulysses/870019 to your computer and use it in GitHub Desktop.
Save braveulysses/870019 to your computer and use it in GitHub Desktop.
iTerm: launch multiple sessions
-- An iTerm 2 launch script. Opens three terminal windows,
-- logs them in to three different hosts,
-- and cd's to a common directory.
--
-- Place in ~/Library/Application Support/iTerm/Scripts
--
global remoteDirectory
set remoteDirectory to "/my/project"
to launchLabSession(sessionName, hostname, directory)
tell application "iTerm"
activate
set thisTerminal to (make new terminal)
tell thisTerminal
launch session "Default"
set thisSession to current session
tell thisSession
set name to sessionName
write text "ssh root@" & hostname
delay 1
write text "cd " & directory
end tell
end tell
end tell
end launchLabSession
launchLabSession("source", "host1.lab", remoteDirectory)
launchLabSession("sync", "host2.lab", remoteDirectory)
launchLabSession("destination", "host3.lab", remoteDirectory)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment