Skip to content

Instantly share code, notes, and snippets.

@ikeikeikeike
Created February 26, 2012 03:34
Show Gist options
  • Save ikeikeikeike/1912782 to your computer and use it in GitHub Desktop.
Save ikeikeikeike/1912782 to your computer and use it in GitHub Desktop.
tmux new-window ssh
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
ssh_windows = {
"host1": "127.0.0.1",
"host2": "123.123.123.123",
"host3": "12.12.12.12",
}
session = ''
for win in ssh_windows:
session += \
'tmux new-window -n %(win)s; tmux send-key -t%(win)s "ssh %(host)s" C-m; ' % \
{'win': win, 'host': ssh_windows[win]}
args = [
'tmux',
'new-session',
session,
]
print 'Running ', args
subprocess.call(args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment