Improve database backup selection logic, Add BINHEX support

Added informative output and correct issue selecting final available backup.
Added binhex (Arch) docker support
Updated READMEmd

Add support for all Docker variants

Change detection to use cgroup

Add BINHEX support,  Update README.md
This commit is contained in:
ChuckPa
2022-12-14 01:42:44 -05:00
parent 8d2e287ecd
commit de8bb48901
2 changed files with 60 additions and 20 deletions

View File

@@ -396,8 +396,8 @@ HostConfig() {
return 0
# Docker
elif [ -f /bin/s6-svscan ] && [ -d "/config/Library/Application Support" ]; then
# Docker (All main docker variants except binhex)
elif [ "$(grep docker /proc/1/cgroup | wc -l)" -gt 0 ] && [ -d "/config/Library/Application Support" ]; then
PLEX_SQLITE="/usr/lib/plexmediaserver/Plex SQLite"
AppSuppDir="/config/Library/Application Support"
@@ -409,6 +409,19 @@ HostConfig() {
HostType="Docker"
return 0
# BINHEX Plex container
elif [ "$(grep docker /proc/1/cgroup | wc -l)" -gt 0 ] && [ -d "/config/Plex Media Server" ]; then
PLEX_SQLITE="/usr/lib/plexmediaserver/Plex SQLite"
AppSuppDir="/config"
PID_FILE="$AppSuppDir/Plex Media Server/plexmediaserver.pid"
DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases"
LOGFILE="$DBDIR/DBRepair.log"
LOG_TOOL="logger"
HostType="BINHEX"
return 0
# Western Digital (OS5)
elif [ -f /etc/system.conf ] && [ -d /mnt/HD/HD_a2/Nas_Prog/plexmediaserver ] && \
grep "Western Digital Corp" /etc/system.conf >/dev/null; then
@@ -959,14 +972,16 @@ do
Output "Checking for a usable backup."
Candidate=""
Output "Database backups available are: $Dates"
for i in $Dates
do
# Check candidate
if [ -e $CPPL.db-$i ] && \
[ -e $CPPL.blobs.db-$i ] && \
CheckDB $CPPL.db-$i && \
CheckDB $CPPL.blobs.db-$i ; then
if [ -e $CPPL.db-$i ] && \
[ -e $CPPL.blobs.db-$i ] && \
Output "Checking database $i" && \
CheckDB $CPPL.db-$i && \
CheckDB $CPPL.blobs.db-$i ; then
Output "Found valid database backup date: $i"
Candidate=$i
@@ -1052,11 +1067,11 @@ do
WriteLog "Replace - Verify databases - FAIL"
Fail=1
fi
fi
# If successful, save
[ $Fail -eq 0 ] && SetLast "Replace" "$TimeStamp"
break
# If successful, save
[ $Fail -eq 0 ] && SetLast "Replace" "$TimeStamp"
break
fi
fi
done