2019-09-16 00:56:18 +02:00
|
|
|
#!/bin/sh
|
2023-08-10 21:47:21 +02:00
|
|
|
|
2019-09-16 00:56:18 +02:00
|
|
|
# supertmux: open a tmux session with ssh connections to some servers
|
|
|
|
|
2023-08-10 21:47:21 +02:00
|
|
|
session=$(hostname -s)
|
2019-09-16 00:56:18 +02:00
|
|
|
servers="db dns ftp mail web"
|
|
|
|
|
|
|
|
tmux kill-server
|
|
|
|
tmux start-server
|
|
|
|
|
2023-08-10 21:47:21 +02:00
|
|
|
tmux new-session -d -s "$session";
|
|
|
|
tmux rename-window hv
|
2019-09-16 00:56:18 +02:00
|
|
|
|
|
|
|
counter=1
|
|
|
|
for server in $servers
|
|
|
|
do
|
2023-08-10 21:47:21 +02:00
|
|
|
tmux new-window -t "$session":"$counter"
|
|
|
|
tmux select-window -t "$session":"$counter"
|
|
|
|
tmux rename-window "$server"
|
|
|
|
tmux send -t "$session":"$counter" "ssh $server" ENTER
|
|
|
|
counter=$(( counter + 1 ))
|
2019-09-16 00:56:18 +02:00
|
|
|
done
|
|
|
|
|
2023-08-10 21:47:21 +02:00
|
|
|
tmux select-window -t "$session":0
|
|
|
|
tmux attach-session -t "$session"
|