fix: pkill patterns — target binary paths, not script itself

This commit is contained in:
Claus Lohmar 2026-08-06 15:04:03 +01:00
parent 31ea59ceea
commit 7b9902f788
2 changed files with 8 additions and 8 deletions

View file

@ -42,12 +42,12 @@ fi
# ── 1. Kill all existing instances ──
log "Stopping any running NextNVR instances..."
sudo systemctl stop "${SERVICE_NAME}" 2>/dev/null || true
sudo pkill -9 -f "nextnvr" 2>/dev/null || true
sudo pkill -9 -f "go2rtc" 2>/dev/null || true
sudo pkill -9 -f "ffmpeg.*rec_" 2>/dev/null || true
sudo pkill -9 -f "/opt/nextnvr/nextnvr" 2>/dev/null || true
sudo pkill -9 -f "go2rtc -config" 2>/dev/null || true
sudo pkill -9 -f "ffmpeg.*-i rtsp" 2>/dev/null || true
sleep 2
if pgrep -f "nextnvr" > /dev/null 2>&1; then
if pgrep -f "/opt/nextnvr/nextnvr" > /dev/null 2>&1; then
err "Cannot kill existing NextNVR processes. Please stop them manually and retry."
exit 1
fi

View file

@ -14,11 +14,11 @@ echo "Stopping service..."
sudo systemctl stop "${SERVICE_NAME}" 2>/dev/null || true
sudo systemctl disable "${SERVICE_NAME}" 2>/dev/null || true
# Kill any lingering processes.
# Kill any lingering processes (target only NextNVR binaries, not the script).
echo "Killing processes..."
sudo pkill -9 -f "nextnvr" 2>/dev/null || true
sudo pkill -9 -f "go2rtc" 2>/dev/null || true
sudo pkill -9 -f "ffmpeg.*rec_" 2>/dev/null || true
sudo pkill -9 -f "/opt/nextnvr/nextnvr" 2>/dev/null || true
sudo pkill -9 -f "go2rtc -config" 2>/dev/null || true
sudo pkill -9 -f "ffmpeg.*-i rtsp" 2>/dev/null || true
sleep 1
# Remove systemd service file.