shell utility functions: add, improve

Add a function to open 4 common osmo vtys and make sure these tmux functions
don't open new sessions if the session already exists
This commit is contained in:
Monocots 2022-10-25 15:33:10 +00:00
parent ab946b6e10
commit 90e9e7032a

View file

@ -79,6 +79,11 @@ o() {
}
f() {
tmux has-session -t SIP 2>/dev/null
if [ $? -eq 0 ] ; then
tmux a -t SIP
return
fi
tmux new-session -n SIP "sudo sngrep -d any" \; splitw -p 60 "fs_cli -r" \; select-window -t SIP \;
}
@ -110,8 +115,41 @@ b<%= index %>() {
}
<% end -%>
vt ()
{
tmux has-session -t vtys 2>/dev/null
if [ $? -eq 0 ] ; then
tmux a -t vtys
return
fi
tmux start-server;
tmux new -s vtys -d -n VTY "vty bsc $*";
for vty in msc mgw hlr;
do
if [ "$vty" == "msc" ]; then
pane=0;
fi;
if [ "$vty" == "hlr" ]; then
pane=2;
fi;
if [ "$vty" == "mgw" -o "$vty" == "hlr" ]; then
split=h;
else
split=v;
fi;
tmux split-window -t $pane -$split "vty $vty $*";
done;
tmux select-pane -t:.0
tmux attach -t vtys ;
}
bA() {
source /home/rhizomatica/bin/vars.sh
tmux has-session -t bts 2>/dev/null
if [ $? -eq 0 ] ; then
tmux a -t bts
return
fi
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