39 lines
1.1 KiB
Bash
Executable file
39 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
# NextNVR — Clean Removal Script
|
|
# Removes all traces for a greenfield redeployment.
|
|
# Usage: ./remove.sh
|
|
|
|
SERVICE_NAME="nextnvr"
|
|
DEPLOY_DIR="/opt/nextnvr"
|
|
|
|
echo "=== NextNVR Clean Removal ==="
|
|
echo ""
|
|
|
|
# Stop service.
|
|
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 (target only NextNVR binaries, not the script).
|
|
echo "Killing processes..."
|
|
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.
|
|
if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]; then
|
|
sudo rm -f "/etc/systemd/system/${SERVICE_NAME}.service"
|
|
sudo systemctl daemon-reload
|
|
echo "Service file removed."
|
|
fi
|
|
|
|
# Remove deployment directory.
|
|
if [ -d "${DEPLOY_DIR}" ]; then
|
|
sudo rm -rf "${DEPLOY_DIR}"
|
|
echo "Removed ${DEPLOY_DIR}"
|
|
fi
|
|
|
|
echo ""
|
|
echo "NextNVR removed. Recordings at /mnt/recordings are untouched."
|
|
echo "Run ./deploy_nvr.sh for a fresh install."
|