Skip to content

Instantly share code, notes, and snippets.

@objectified
Last active January 2, 2016 09:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save objectified/8285494 to your computer and use it in GitHub Desktop.
Save objectified/8285494 to your computer and use it in GitHub Desktop.
Simple shell script that wraps tmux to simulate clusterssh behaviour, while not needing X and having all the advantages of tmux. Run as: ./uberssh.sh my_session_name host1 host2 host3To toggle between input synchronization, use "ctrl+b u".
#!/bin/bash
TMUX_PATH="/usr/bin/tmux"
SESS_NAME="$1"
shift
HOSTS="$*"
let ctr=0
for h in $HOSTS; do
if [ $ctr -eq 0 ]; then
$TMUX_PATH new-session -d -s $SESS_NAME "ssh $h"
else
$TMUX_PATH splitw -t $SESS_NAME:0 "ssh $h"
$TMUX_PATH select-layout -t $SESS_NAME:0 tiled
fi
let ctr=ctr+1
done
$TMUX_PATH set-window-option -t $SESS_NAME:0 synchronize-panes on
$TMUX_PATH select-pane -t $SESS_NAME:0
$TMUX_PATH bind-key u set-window-option synchronize-panes
$TMUX_PATH attach -t $SESS_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment