arehbein has uploaded this change for review. ( 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(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/64/30364/1
diff --git a/ttcn3-tcpdump-start.sh b/ttcn3-tcpdump-start.sh index aa42e62..4c68448 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 }