Last active
January 2, 2016 09:49
-
-
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".
This file contains 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
#!/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