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
This commit is contained in:
arehbein 2022-11-28 22:39:21 +01:00
parent ef0b3e6bb4
commit e66c1f8e5a
2 changed files with 8 additions and 4 deletions

View File

@ -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
if [ -e "$1" ]; then
if [ -s "$1" ]; then
$SUDOSTR kill "$(cat "$1")" 2>&1 | grep -v "No such process"
fi
rm $1
fi
}

View File

@ -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
if [ -e "$1" ]; then
if [ -s "$1" ]; then
$SUDOSTR kill "$(cat "$1")" 2>&1 | grep -v "No such process"
fi
rm $1
fi
}