arehbein has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/30364 )
Change subject: ttcn3-tcpdump*.sh: Fix tcpdump procs not being killed
......................................................................
ttcn3-tcpdump*.sh: Fix tcpdump procs not being killed
Also: Fix possibly empty files not being deleted.
Fixes: cf8c450ed5f9c8e9f767509fa156cf2368aaebe6
Fixes: OS#5796
Change-Id: I4e17d8313755c36f130982c921abf69d78c98ae6
---
M ttcn3-tcpdump-start.sh
M ttcn3-tcpdump-stop.sh
2 files changed, 8 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
arehbein: Looks good to me, approved
diff --git a/ttcn3-tcpdump-start.sh b/ttcn3-tcpdump-start.sh
index aa42e62..c4905d9 100755
--- a/ttcn3-tcpdump-start.sh
+++ b/ttcn3-tcpdump-start.sh
@@ -21,8 +21,10 @@
kill_rm_pidfile() {
# NOTE: This requires you to be root or something like
# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
- if ! [ -e "$1" ] && [ -s "$1" ]; then
- $SUDOSTR kill "$(cat "$1")" 2>&1 | grep -v "No such
process"
+ if [ -e "$1" ]; then
+ if [ -s "$1" ]; then
+ $SUDOSTR kill "$(cat "$1")" 2>&1 | grep -v "No such
process"
+ fi
rm $1
fi
}
diff --git a/ttcn3-tcpdump-stop.sh b/ttcn3-tcpdump-stop.sh
index b479530..0feaeaa 100755
--- a/ttcn3-tcpdump-stop.sh
+++ b/ttcn3-tcpdump-stop.sh
@@ -16,8 +16,10 @@
kill_rm_pidfile() {
# NOTE: This requires you to be root or something like
# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
- if ! [ -e "$1" ] && [ -s "$1" ]; then
- $SUDOSTR kill "$(cat "$1")" 2>&1 | grep -v "No such
process"
+ if [ -e "$1" ]; then
+ if [ -s "$1" ]; then
+ $SUDOSTR kill "$(cat "$1")" 2>&1 | grep -v "No such
process"
+ fi
rm $1
fi
}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/30364
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I4e17d8313755c36f130982c921abf69d78c98ae6
Gerrit-Change-Number: 30364
Gerrit-PatchSet: 2
Gerrit-Owner: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged