From 31ea59ceea34cfcb315075e6f996939e603cd3cb Mon Sep 17 00:00:00 2001 From: cclohmar Date: Thu, 6 Aug 2026 14:58:47 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20remove.sh=20=E2=80=94=20clean=20removal?= =?UTF-8?q?=20for=20greenfield=20redeployment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- remove.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 remove.sh diff --git a/remove.sh b/remove.sh new file mode 100755 index 0000000..1691324 --- /dev/null +++ b/remove.sh @@ -0,0 +1,39 @@ +#!/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. +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 +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."