Update Jellyfin_Fix_and_Scan.sh
added 2nd option to test the DB instead of reading logs
This commit is contained in:
parent
f2105d6f4f
commit
93a6779b17
1 changed files with 32 additions and 0 deletions
|
@ -43,6 +43,38 @@ else
|
|||
echo "No error found in journal."
|
||||
fi
|
||||
|
||||
greenecho "Double checking the DB integrity"
|
||||
|
||||
# Run the SQLite integrity check and capture the output
|
||||
output=$(sudo sqlite3 /var/lib/jellyfin/data/library.db "PRAGMA integrity_check;")
|
||||
|
||||
# Check if the output indicates that the database is OK
|
||||
if [[ "$output" != "ok" ]]; then
|
||||
|
||||
echo "Database integrity check failed: $output"
|
||||
# Stop Jellyfin
|
||||
sudo systemctl stop jellyfin
|
||||
yellowecho "Waiting 60 seconds for jellyfin to stop"
|
||||
sleep 60
|
||||
# Remove bad DB
|
||||
rm -f /var/lib/jellyfin/data/library.db
|
||||
rm -f /var/lib/jellyfin/data/library.db*
|
||||
# Replace bad DB
|
||||
cp "/path/to/backups/Jellyfin/library.db.master" "/var/lib/jellyfin/data/library.db"
|
||||
# Fix Permissions
|
||||
/usr/bin/chown jellyfin:jellyfin "/var/lib/jellyfin/data/library.db"
|
||||
/usr/bin/chmod 600 "/var/lib/jellyfin/data/library.db"
|
||||
greenecho "Database file replaced with backup."
|
||||
greenecho "Starting Jellyfin."
|
||||
yellowecho "Waiting 60 seconds so JF can start."
|
||||
# Start Jellyfin
|
||||
sudo systemctl start jellyfin
|
||||
sleep 60
|
||||
else
|
||||
|
||||
greenecho "Database integrity is OK."
|
||||
fi
|
||||
|
||||
|
||||
#Even if no DB curruption, update the live TV, why not?
|
||||
# Trigger Live TV / M3U scan
|
||||
|
|
Loading…
Add table
Reference in a new issue