Update Release Notes & README.md

Logging - Add missing logging record when making active
One logging record was missing.

Add DSM 7 Task Scheduler usage documentation
This commit is contained in:
ChuckPa 2024-01-12 16:46:55 -05:00
parent d6d6c47928
commit 8863beeab2
No known key found for this signature in database
GPG Key ID: 3CE28A0F6BC31B5B
3 changed files with 69 additions and 4 deletions

View File

@ -2,12 +2,12 @@
######################################################################### #########################################################################
# Plex Media Server database check and repair utility script. # # Plex Media Server database check and repair utility script. #
# Maintainer: ChuckPa # # Maintainer: ChuckPa #
# Version: v1.02.00 # # Version: v1.02.01 #
# Date: 26-Nov-2023 # # Date: 12-Jan-2024 #
######################################################################### #########################################################################
# Version for display purposes # Version for display purposes
Version="v1.02.00" Version="v1.02.01"
# Flag when temp files are to be retained # Flag when temp files are to be retained
Retain=0 Retain=0
@ -945,6 +945,7 @@ DoRepair() {
[ -e $CPPL.blobs.db ] && mv $CPPL.blobs.db "$TMPDIR/$CPPL.blobs.db-BACKUP-$TimeStamp" [ -e $CPPL.blobs.db ] && mv $CPPL.blobs.db "$TMPDIR/$CPPL.blobs.db-BACKUP-$TimeStamp"
Output "Making repaired databases active" Output "Making repaired databases active"
WriteLog "Making repaired databases active"
mv "$TMPDIR/$CPPL.db-REPAIR-$TimeStamp" $CPPL.db mv "$TMPDIR/$CPPL.db-REPAIR-$TimeStamp" $CPPL.db
mv "$TMPDIR/$CPPL.blobs.db-REPAIR-$TimeStamp" $CPPL.blobs.db mv "$TMPDIR/$CPPL.blobs.db-REPAIR-$TimeStamp" $CPPL.blobs.db

View File

@ -693,4 +693,60 @@ root@lizum:/sata/plex/Plex Media Server/Plug-in Support/Databases#
Instructs SQLite to remove the empty/deleted records and gaps from the databases. Instructs SQLite to remove the empty/deleted records and gaps from the databases.
This is most beneficial after deleting whole library sections. This is most beneficial after deleting whole library sections.
### # Special considerations - Synology DSM 7
Using DBRepair on Synology DSM 7 systems with Task Scheduler requires special handling.
DSM 7 has additional security (app-armor). Care must be taken to not violate this.
One exception must be implemented. Care must be used to implement.
### DSM 7 - Step 1 - Designate a DSM username which will run DBRepair
- Creating a to-task username with a complex password is best practice
- Create a Scheduled task, user-script:
- Runs as root
- Emails you the result
- Is not scheduled
- Is disabled in the Task Scheduler task list
Contents of the user-script are:
```
#!/bin/bash
#
# This script grants the given syno username (your username)
# the ability to elevate to 'root' privilege for use with DBRepair.sh
#
# Set your desired Syno username here (no spaces)
MyUsername=chuck
# Confirm username exists
if [ "$(id $MyUsername)" = "" ]; then
echo ERROR: No such user \'$MyUsername\'
exit 1
fi
# Remove old record
sed -i s/^${MyUsername}.\*$// /etc/sudoers
# Add myself to sudoers
echo "$MyUsername" 'ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
```
### DSM 7 - Step 2 - Run DBRepair as the designated username
With the security now set, DBRepair can be invoked from Task Scheduler.
Download and place DBRepair.sh in the desired location (PlexMediaServer shared folder ok)
Make certain it's executable.
Create Scheduled Task - User-Script to run DBRepair
- Runs as the selected username
- Emails you the result
- Runs on the schedule you desire (Weekly after PMS scheduled tasks completed is optimal)
```
#!/bin/bash
# Go to the PlexMediaServer shared folder
cd /var/packages/PlexMediaServer/shares/PlexMediaServer
# Run classic Stop PMS, Automatic optimization/repair, Start PMS, and exit sequence
sudo ./DBRepair.sh stop auto start exit
```

View File

@ -8,6 +8,14 @@
![Maintenance](https://img.shields.io/badge/Maintained-Yes-green.svg) ![Maintenance](https://img.shields.io/badge/Maintained-Yes-green.svg)
# Release Info: # Release Info:
v1.02.01
- Minor fix to logging. One line of output at the console was not present in the logfile
(this is important when diagnosing after connection-loss scenarios and DBRepair.sh was interrupted)
- Added documentation in README.md for using DBRepair with Synology DSM 7 Task Scheduler.
(Maintains app-armor compliance)
v1.02.00 v1.02.00
- Provide menu option to ignore/honor "Duplicate" and "UNIQUE Constraint" errors during DB Repair, - Provide menu option to ignore/honor "Duplicate" and "UNIQUE Constraint" errors during DB Repair,