mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 22:43:56 +08:00
17 lines
444 B
Bash
Executable File
17 lines
444 B
Bash
Executable File
#!/bin/sh
|
|
|
|
PIDFILE="/var/run/packet_capture.pid"
|
|
|
|
pid=$(cat "$PIDFILE" 2>/dev/null)
|
|
case "$pid" in ''|*[!0-9]*) pid="" ;; esac
|
|
if [ -n "$pid" ] && grep -sq packet_capture "/proc/$pid/cmdline"; then
|
|
ppid=$(pgrep -P $pid)
|
|
[ -n "$ppid" ] && kill -TERM $ppid
|
|
else
|
|
# Nothing runs it any more (the helper died on an error before removing
|
|
# it): a stale pidfile made every later start answer "running".
|
|
rm -f "$PIDFILE"
|
|
fi
|
|
|
|
exit 0
|