ping_template: attach if session exists

This commit is contained in:
Nico Schottelius 2023-09-06 13:24:43 +02:00
parent 78fae44ff7
commit 0ad561ec0b

View file

@ -2,30 +2,35 @@
conn=$1; shift conn=$1; shift
if tmux ls | grep ^${conn}:; then
tmux attach -t ${conn}
exit 0
fi
case "$conn" in case "$conn" in
rm) rm)
tmux new-session -s ping_rm -d ping 2a0f:98c0:1::2 tmux new-session -s ${conn} -d ping 2a0f:98c0:1::2
tmux split-window -t ping_rm -h ping 2a0f:98c0:2::2 tmux split-window -t ${conn} -h ping 2a0f:98c0:2::2
tmux split-window -t ping_rm -h ping 2a0f:98c0:9::2 tmux split-window -t ${conn} -h ping 2a0f:98c0:9::2
tmux select-layout -t ping_rm even-horizontal tmux select-layout -t ${conn} even-horizontal
tmux split-window -t ping_rm -v ping 2a0f:98c0:9::3 tmux split-window -t ${conn} -v ping 2a0f:98c0:9::3
tmux select-pane -t ping_rm -L tmux select-pane -t ${conn} -L
tmux split-window -t ping_rm -v ping 2a0f:98c0:2::3 tmux split-window -t ${conn} -v ping 2a0f:98c0:2::3
tmux select-pane -t ping_rm -L tmux select-pane -t ${conn} -L
tmux split-window -t ping_rm -v ping 2a0f:98c0:1::3 tmux split-window -t ${conn} -v ping 2a0f:98c0:1::3
tmux attach -t ping_rm tmux attach -t ${conn}
;; ;;
rmapu) rmapu)
tmux new-session -s ping_rm -d ping 2a0f:98c0:1::15 tmux new-session -s ${conn} -d ping 2a0f:98c0:1::15
tmux split-window -t ping_rm -h ping 2a0f:98c0:2::15 tmux split-window -t ${conn} -h ping 2a0f:98c0:2::15
tmux split-window -t ping_rm -h ping 2a0f:98c0:9::15 tmux split-window -t ${conn} -h ping 2a0f:98c0:9::15
tmux select-layout -t ping_rm even-horizontal tmux select-layout -t ${conn} even-horizontal
tmux split-window -t ping_rm -v ping 2a0f:98c0:9::16 tmux split-window -t ${conn} -v ping 2a0f:98c0:9::16
tmux select-pane -t ping_rm -L tmux select-pane -t ${conn} -L
tmux split-window -t ping_rm -v ping 2a0f:98c0:2::16 tmux split-window -t ${conn} -v ping 2a0f:98c0:2::16
tmux select-pane -t ping_rm -L tmux select-pane -t ${conn} -L
tmux split-window -t ping_rm -v ping 2a0f:98c0:1::16 tmux split-window -t ${conn} -v ping 2a0f:98c0:1::16
tmux attach -t ping_rm tmux attach -t ${conn}
;; ;;
rmv6) rmv6)
tmux new-session -s rmv6 -d ping 2a0f:98c0:7::1 tmux new-session -s rmv6 -d ping 2a0f:98c0:7::1