Created
February 26, 2012 03:34
-
-
Save ikeikeikeike/1912782 to your computer and use it in GitHub Desktop.
tmux new-window ssh
This file contains hidden or 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
#!/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