From b2351d2679b59033f6154a981df25611dc25f2b5 Mon Sep 17 00:00:00 2001 From: Keith Whyte Date: Fri, 28 May 2021 02:21:37 +0200 Subject: [PATCH] Add shell function: ssh to all BTS in tmux --- .../templates/rccn-functions.sh.erb | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/rhizo_base/templates/rccn-functions.sh.erb b/modules/rhizo_base/templates/rccn-functions.sh.erb index 58ff7f5..f99cc56 100644 --- a/modules/rhizo_base/templates/rccn-functions.sh.erb +++ b/modules/rhizo_base/templates/rccn-functions.sh.erb @@ -98,6 +98,27 @@ b<%= index %>() { } <% end -%> +bA() { + tmux start-server + tmux new -s bts -d -n BTS0 "source /etc/profile.d/rccn-functions.sh ; b0" + # This won't look great for more than 4 windows, but + # that is not a lot of space anyway. + pane=0 + for bts in "${!BTS[@]}" ; do + if [ $bts == 0 ] ; then continue; fi + if [ $bts == 3 ] ; then + pane=2; + fi + if [ $bts -lt 2 ] ; then + split=h + else + split=v + fi + tmux split-window -t $pane -$split "source /etc/profile.d/rccn-functions.sh ; b$bts" + done + tmux attach -t bts +} + pdp () { expect -c 'spawn -noecho telnet 0 4245; expect >; send enable\r; expect #; send "show pdp-context all\r"; expect #' | grep "PDP Address" | grep -v invalid | sort -t. -n -k3,3n -k4,4n; echo Count: $(pdpc)