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 \