ttcn3-tcpdump*.sh: Fix tcpdump procs not being killed

Also: Fix possibly empty files not being deleted.

Fixes: cf8c450ed5
Fixes: OS#5796
Change-Id: I4e17d8313755c36f130982c921abf69d78c98ae6
changes/64/30364/2
Alexander Rehbein 4 months ago
parent ef0b3e6bb4
commit e66c1f8e5a

@ -21,8 +21,10 @@ fi
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
}

@ -16,8 +16,10 @@ fi
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
}

Loading…
Cancel
Save