supertmux: open multiple ssh sessions to a bunch of servers inside a tmux (based on superscreen)
This commit is contained in:
parent
a1f9115672
commit
f40ada3a76
2 changed files with 29 additions and 0 deletions
|
@ -14,6 +14,7 @@ Scripts
|
|||
* [randomwallpaper.sh](https://forge.tourmentine.com/n/scripts/src/master/randomwallpaper.sh) => display a random wallpaper
|
||||
* [secupdate](https://forge.tourmentine.com/n/scripts/src/master/secupdate) => apply security updates & recompile kernel (FreeBSD)
|
||||
* [superscreen](https://forge.tourmentine.com/n/scripts/src/master/superscreen) => open multiple ssh sessions to a bunch of servers inside a screen
|
||||
* [superscreen](https://forge.tourmentine.com/n/scripts/src/master/supertmux) => open multiple ssh sessions to a bunch of servers inside a tmux
|
||||
* [zfsync.sh](https://forge.tourmentine.com/n/scripts/src/master/zfsync.sh) => sync some ZFS pools between two machines
|
||||
|
||||
Greasemonkey/Userscripts
|
||||
|
|
28
supertmux
Executable file
28
supertmux
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
# supertmux: open a tmux session with ssh connections to some servers
|
||||
|
||||
session=`hostname -s`
|
||||
servers="db dns ftp mail web"
|
||||
|
||||
tmux kill-server
|
||||
tmux start-server
|
||||
|
||||
tmux new-session -d -s $session;
|
||||
tmux rename-window $session
|
||||
|
||||
tmux set-option status-style fg=white,bg=black
|
||||
tmux set-option -g status-right "[%D %H:%M]"
|
||||
tmux set-option -g status-justify centre
|
||||
|
||||
counter=1
|
||||
for server in $servers
|
||||
do
|
||||
tmux new-window -t $session:$counter
|
||||
tmux select-window -t $session:$counter
|
||||
tmux rename-window $server
|
||||
tmux send -t $session:$counter "ssh $server" ENTER
|
||||
let counter=$counter+1 >/dev/null
|
||||
done
|
||||
|
||||
tmux select-window -t $session:0
|
||||
tmux attach-session -t $session
|
Loading…
Reference in a new issue