Permalink
Browse files

Add GNOME Terminal tabs script.

  • Loading branch information...
1 parent 5efcdd6 commit e0651992608e08204b3812b3e8a30f235157c780 @SimonSapin committed Feb 20, 2011
Showing with 19 additions and 0 deletions.
  1. +19 −0 gnome_terminal_tabs.py
View
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"""
+ Run a command on multiple servers via SSH, each in a GNOME Terminal tab.
+ See http://exyr.org/2011/gnome-terminal-tabs/
+"""
+
+import subprocess
+
+command = 'sudo aptitude update && sudo aptitude safe-upgrade'
+terminal = ['gnome-terminal']
+for host in ('cartonbox', 'hako'):
+ terminal.extend(['--tab', '-e', '''
+ bash -c '
+ echo "%(host)s$ %(command)s"
+ ssh -t %(host)s "%(command)s"
+ read
+ '
+ ''' % locals()])
+subprocess.call(terminal)

0 comments on commit e065199

Please sign in to comment.