summaryrefslogtreecommitdiffstats
path: root/ttcn3-tcpdump-stop.sh
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-02-14 15:42:14 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-14 18:50:16 +0100
commite057146df7b16f34bf7fd59510e692cb9691f85b (patch)
tree994a425cedb638998fc1b7b8392c7e708870e4a7 /ttcn3-tcpdump-stop.sh
parent261af4b501b063e2ca190b40b8262200f866a98b (diff)
re-organize configuration files; add tcpdump integration
Let's make sure we share common configuration between the test suites and split the config file into a "default" part which is used (but not copied) in the Docker images, and a "local" part which is basically those overrides that the user (or docker image) wants to do from the default. Change-Id: I3db452e24e5238aa05254d903739c64d202e61db
Diffstat (limited to 'ttcn3-tcpdump-stop.sh')
-rwxr-xr-xttcn3-tcpdump-stop.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/ttcn3-tcpdump-stop.sh b/ttcn3-tcpdump-stop.sh
new file mode 100755
index 0000000..575c0ef
--- /dev/null
+++ b/ttcn3-tcpdump-stop.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+PIDFILE=/tmp/tcpdump.pid
+
+if [ -e $PIDFILE ]; then
+ # NOTE: This requires you to be root or something like
+ # "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
+ if [ "$(id -u)" = "0" ]; then
+ kill "$(cat "$PIDFILE")"
+ else
+ sudo kill "$(cat "$PIDFILE")"
+ fi
+ rm $PIDFILE
+fi