osmith submitted this change.

View Change

Approvals: neels: Looks good to me, approved pespin: Looks good to me, but someone else must approve osmith: Verified
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(-)

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 change 26667. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-Change-Id: Iaf6c175de2edf720009af13eace2b0ef83b0735b
Gerrit-Change-Number: 26667
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged