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:
parent
ef0b3e6bb4
commit
e66c1f8e5a
|
@ -21,8 +21,10 @@ fi
|
||||||
kill_rm_pidfile() {
|
kill_rm_pidfile() {
|
||||||
# NOTE: This requires you to be root or something like
|
# NOTE: This requires you to be root or something like
|
||||||
# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
|
# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
|
||||||
if ! [ -e "$1" ] && [ -s "$1" ]; then
|
if [ -e "$1" ]; then
|
||||||
$SUDOSTR kill "$(cat "$1")" 2>&1 | grep -v "No such process"
|
if [ -s "$1" ]; then
|
||||||
|
$SUDOSTR kill "$(cat "$1")" 2>&1 | grep -v "No such process"
|
||||||
|
fi
|
||||||
rm $1
|
rm $1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,10 @@ fi
|
||||||
kill_rm_pidfile() {
|
kill_rm_pidfile() {
|
||||||
# NOTE: This requires you to be root or something like
|
# NOTE: This requires you to be root or something like
|
||||||
# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
|
# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
|
||||||
if ! [ -e "$1" ] && [ -s "$1" ]; then
|
if [ -e "$1" ]; then
|
||||||
$SUDOSTR kill "$(cat "$1")" 2>&1 | grep -v "No such process"
|
if [ -s "$1" ]; then
|
||||||
|
$SUDOSTR kill "$(cat "$1")" 2>&1 | grep -v "No such process"
|
||||||
|
fi
|
||||||
rm $1
|
rm $1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue