aboutsummaryrefslogtreecommitdiffstats
path: root/ttcn3-tcpdump-stop.sh
blob: 575c0eff494740f6047edbcb00438f9984f6d3e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

PIDFILE=/tmp/tcpdump.pid

if [ -e $PIDFILE ]; then
	# NOTE: This requires you to be root or something like
	# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
	if [ "$(id -u)" = "0" ]; then
		kill "$(cat "$PIDFILE")"
	else
		sudo kill "$(cat "$PIDFILE")"
	fi
	rm $PIDFILE
fi