Files
dotfiles/bin/sshnodes.sh
2021-09-01 11:14:24 -04:00

27 lines
702 B
Bash
Executable File

#!/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
tmux set-option -wg synchronize-panes on
fi
# Attach Session, on the Main window
tmux attach-session -t $SESSION:0