Update Jellyfin_Fix_and_Scan.sh

Added comments for easier readability
This commit is contained in:
Clarth 2024-02-15 19:43:33 -05:00
parent ef9ace1040
commit 8c174fb611
1 changed files with 9 additions and 1 deletions

View File

@ -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 either error message is found, delete the database file and trigger library scan
if [ -n "$error_found_1" ] || [ -n "$error_found_2" ]; then if [ -n "$error_found_1" ] || [ -n "$error_found_2" ]; then
echo "Error found in journal, deleting database file..." 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 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" 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" /usr/bin/chown jellyfin:jellyfin "/var/lib/jellyfin/data/library.db"
echo "Database file replaced with backup." echo "Database file replaced with backup."
# Start Jellyfin
sudo systemctl start jellyfin
sleep 30
# Trigger library scan # Trigger library scan
echo "Triggering library scan..." echo "Triggering library scan..."
curl -X POST \ curl -X POST \