Change in osmo-dev[master]: net/templates/run.sh: refactor kill logic

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Tue Dec 21 19:57:46 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-dev/+/26667 )


Change subject: net/templates/run.sh: refactor kill logic
......................................................................

net/templates/run.sh: refactor kill logic

Put the terminal PIDs into a variable instead of running kill %1 %2 etc.
This makes it easier to conditionally spawn some of the programs.

Change-Id: Iaf6c175de2edf720009af13eace2b0ef83b0735b
---
M net/templates/run.sh
1 file changed, 34 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/67/26667/1

diff --git a/net/templates/run.sh b/net/templates/run.sh
index 8571a42..cd0fc72 100755
--- a/net/templates/run.sh
+++ b/net/templates/run.sh
@@ -118,33 +118,62 @@
 sudo tcpdump -i $dev -n -w current_log/$dev.single.pcap -U not port 22 &
 sudo tcpdump -i lo -n -w current_log/lo.single.pcap -U not port 22 &
 
+PIDS=""
+
 term "$ggsn" GGSN &
+PIDS="$PIDS $!"
+
 sleep .2
 term "$stp" STP &
+PIDS="$PIDS $!"
+
 sleep .2
 term "$hlr" HLR &
+PIDS="$PIDS $!"
+
 sleep .2
 term "$sgsn" SGSN &
+PIDS="$PIDS $!"
+
 sleep .2
 term "$gbproxy" GBPROXY &
+PIDS="$PIDS $!"
+
 sleep .2
 term "$mgw4msc" MGW4MSC &
+PIDS="$PIDS $!"
+
 sleep .2
 term "$mgw4bsc" MGW4BSC &
+PIDS="$PIDS $!"
+
 sleep .2
 term "$msc" MSC &
+PIDS="$PIDS $!"
+
 sleep 2
 term "$hnbgw" HNBGW &
+PIDS="$PIDS $!"
+
 sleep .2
 term "$bsc" BSC &
+PIDS="$PIDS $!"
 
 if [ "x${MSC_MNCC}" != "xinternal" ]; then
   sleep .2
   term "$sipcon" SIPCON &
+  PIDS="$PIDS $!"
+
   sleep .2
   case "${PBX_SERVER}" in
-    "kamailio") term "$kamailio" KAMAILIO &;;
-    "freeswitch") term "./freeswitch/freeswitch.sh" FREESWITCH &;;
+    "kamailio")
+      term "$kamailio" KAMAILIO &
+      PIDS="$PIDS $!"
+      ;;
+    "freeswitch")
+      term "./freeswitch/freeswitch.sh" FREESWITCH &
+      PIDS="$PIDS $!"
+      ;;
   esac
 fi
 
@@ -157,7 +186,9 @@
 
 #ssh bts neels/stop_remote.sh
 
-kill %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14
+for i in $PIDS; do
+  kill "$i"
+done
 killall osmo-msc
 killall osmo-bsc
 killall osmo-gbproxy

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/26667
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-Change-Id: Iaf6c175de2edf720009af13eace2b0ef83b0735b
Gerrit-Change-Number: 26667
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211221/47a6e81a/attachment.htm>


More information about the gerrit-log mailing list