From 8c174fb6111b89f7622170d0ca6ff158c12ff69e Mon Sep 17 00:00:00 2001 From: Clarth Date: Thu, 15 Feb 2024 19:43:33 -0500 Subject: [PATCH] Update Jellyfin_Fix_and_Scan.sh Added comments for easier readability --- Jellyfin_Fix_and_Scan.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Jellyfin_Fix_and_Scan.sh b/Jellyfin_Fix_and_Scan.sh index 127b010..3dfb502 100644 --- a/Jellyfin_Fix_and_Scan.sh +++ b/Jellyfin_Fix_and_Scan.sh @@ -14,12 +14,20 @@ error_found_2=$(journalctl -u jellyfin --since "1 hour ago" | grep "$error_messa # If either error message is found, delete the database file and trigger library scan if [ -n "$error_found_1" ] || [ -n "$error_found_2" ]; then echo "Error found in journal, deleting database file..." + # Stop Jellyfin + sudo systemctl stop jellyfin + # Remove bad DB rm -f /var/lib/jellyfin/data/library.db - # Optionally, replace with a backup and set correct permissions here. + # Replace bad DB cp "/path/to/backups/Jellyfin/library.db" "/var/lib/jellyfin/data/library.db" + # Fix Permissions /usr/bin/chown jellyfin:jellyfin "/var/lib/jellyfin/data/library.db" echo "Database file replaced with backup." + # Start Jellyfin + sudo systemctl start jellyfin + sleep 30 + # Trigger library scan echo "Triggering library scan..." curl -X POST \