feat: remove.sh — clean removal for greenfield redeployment
This commit is contained in:
parent
b2e4dface2
commit
31ea59ceea
1 changed files with 39 additions and 0 deletions
39
remove.sh
Executable file
39
remove.sh
Executable file
|
|
@ -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."
|
||||
Loading…
Reference in a new issue