diff --git a/bin/sshnodes.sh b/bin/sshnodes.sh new file mode 100755 index 0000000..9c916a9 --- /dev/null +++ b/bin/sshnodes.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Set Session Name +SESSION="sshnodes" +SESSIONEXISTS=$(tmux list-sessions | grep $SESSION) + +# Only create tmux session if it doesn't already exist +if [ "$SESSIONEXISTS" = "" ] +then + # Start New Session with our name + tmux new-session -d -s $SESSION + tmux rename-window -t sshnodes + tmux split-window -v + tmux split-window -h + tmux selectp -t 0 + tmux split-window -h + tmux send-keys -t 0 "autossh odroid1" C-m + tmux send-keys -t 1 "autossh odroid2" C-m + tmux send-keys -t 2 "autossh odroid3" C-m + tmux send-keys -t 3 "autossh odroid4" C-m + +fi + +# Attach Session, on the Main window +tmux attach-session -t $SESSION:0 +