Repository navigation
Synology DSM7
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 exercised.
Creating a task-specific username with a complex password is best practice.
Create a Scheduled task, user-script, which:
- 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
#
# Set your desired Syno username here (no spaces in the username)
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/sudoersWith the security now set, DBRepair can be invoked from Task Scheduler.
Download and place the extracted DBRepair binary in the desired location (PlexMediaServer shared folder ok). Make certain it's executable.
Create Scheduled Task - User-Script to run DBRepair, which:
- Runs as the selected username
- Emails you the result
- Runs on the schedule you desire (Weekly after Plex Media Server scheduled tasks completed is optimal)
#!/bin/bash
# Go to the PlexMediaServer shared folder
cd /var/packages/PlexMediaServer/shares/PlexMediaServer
# Run an intelligent "Stop PMS - Automatic - Start PMS" and exit sequence
sudo ./DBRepair auto exitDocumentation for DBRepair v26.10.00
DBRepair is proprietary software. Copyright: @ChuckPA 2022-2026 All Rights Reserved.
Use at own risk! This tool is not associated with Plex Inc.