Skip to content

Instantly share code, notes, and snippets.

@qgp9
Last active August 8, 2016 15:13
Show Gist options
  • Save qgp9/5e55cf789ceecd133d0c1024fee5cd26 to your computer and use it in GitHub Desktop.
Save qgp9/5e55cf789ceecd133d0c1024fee5cd26 to your computer and use it in GitHub Desktop.
monitoring with tmux
#!/bin/bash
com=${1:-"htop"}
tname=mon
twin=mon
tnw=$tname:$twin
tmux has-session -t $tname
if [ $? != 0 ]
then
tmux new-session -s $tname -n $twin -d ssh -t a1 "$com"
tmux split-window -t $tnw.0 -h ssh -t v1 "$com"
tmux split-window -t $tnw.0 -v ssh -t v2 "$com"
tmux split-window -t $tnw.1 -v ssh -t vr "$com"
tmux select-pane -t $tnw.0
fi
tmux attach -t $tname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment