From 8863beeab2e0ad912f27ef25e2b43971858570e9 Mon Sep 17 00:00:00 2001 From: ChuckPa Date: Fri, 12 Jan 2024 16:46:55 -0500 Subject: [PATCH] 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 --- DBRepair.sh | 7 ++++--- README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++- ReleaseNotes | 8 ++++++++ 3 files changed, 69 insertions(+), 4 deletions(-) diff --git a/DBRepair.sh b/DBRepair.sh index 9495811..6c9d0d3 100755 --- a/DBRepair.sh +++ b/DBRepair.sh @@ -2,12 +2,12 @@ ######################################################################### # Plex Media Server database check and repair utility script. # # Maintainer: ChuckPa # -# Version: v1.02.00 # -# Date: 26-Nov-2023 # +# Version: v1.02.01 # +# Date: 12-Jan-2024 # ######################################################################### # Version for display purposes -Version="v1.02.00" +Version="v1.02.01" # Flag when temp files are to be retained Retain=0 @@ -945,6 +945,7 @@ DoRepair() { [ -e $CPPL.blobs.db ] && mv $CPPL.blobs.db "$TMPDIR/$CPPL.blobs.db-BACKUP-$TimeStamp" Output "Making repaired databases active" + WriteLog "Making repaired databases active" mv "$TMPDIR/$CPPL.db-REPAIR-$TimeStamp" $CPPL.db mv "$TMPDIR/$CPPL.blobs.db-REPAIR-$TimeStamp" $CPPL.blobs.db diff --git a/README.md b/README.md index 38e3fa8..3ba4711 100644 --- a/README.md +++ b/README.md @@ -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. 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 +``` diff --git a/ReleaseNotes b/ReleaseNotes index 1fbcc7a..ce1fc61 100644 --- a/ReleaseNotes +++ b/ReleaseNotes @@ -8,6 +8,14 @@ ![Maintenance](https://img.shields.io/badge/Maintained-Yes-green.svg) # 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 - Provide menu option to ignore/honor "Duplicate" and "UNIQUE Constraint" errors during DB Repair,