mirror of
https://github.com/ChuckPa/PlexDBRepair.git
synced 2025-11-06 03:08:55 -05:00
Change start/stop logic and timeout handling
This commit is contained in:
parent
9d81f942cf
commit
9073ffa445
29
DBRepair.sh
29
DBRepair.sh
@ -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.0.10 #
|
# Version: v1.0.11 #
|
||||||
# Date: 30-Jul-2023 #
|
# Date: 15-Aug-2023 #
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
# Version for display purposes
|
# Version for display purposes
|
||||||
Version="v1.0.10"
|
Version="v1.0.11"
|
||||||
|
|
||||||
# Flag when temp files are to be retained
|
# Flag when temp files are to be retained
|
||||||
Retain=0
|
Retain=0
|
||||||
@ -1383,22 +1383,35 @@ DoStop(){
|
|||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
|
|
||||||
|
if IsRunning; then
|
||||||
Output "Stopping PMS."
|
Output "Stopping PMS."
|
||||||
|
else
|
||||||
|
Output "PMS already stopped."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
$StopCommand > /dev/null 2> /dev/null
|
$StopCommand > /dev/null 2> /dev/null
|
||||||
Result=$?
|
Result=$?
|
||||||
|
if [ $Result -ne 0 ]; then
|
||||||
|
Output "Cannot send stop command to PMS, error $Result. Please stop manually."
|
||||||
|
WriteLog "Cannot send stop command to PMS, error $Result. Please stop manually."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
Count=10
|
Count=10
|
||||||
while [ $Result -eq 0 ] && IsRunning && [ $Count -gt 0 ]
|
while IsRunning && [ $Count -gt 0 ]
|
||||||
do
|
do
|
||||||
sleep 1
|
sleep 3
|
||||||
Count=$((Count - 1))
|
Count=$((Count - 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $Result -eq 0 ]; then
|
if ! IsRunning; then
|
||||||
WriteLog "Stop - PASS"
|
WriteLog "Stop - PASS"
|
||||||
Output "Stopped PMS."
|
Output "Stopped PMS."
|
||||||
|
return 0
|
||||||
else
|
else
|
||||||
WriteLog "Stop - FAIL ($Result)"
|
WriteLog "Stop - FAIL (Timeout)"
|
||||||
Output "Could not stop PMS. Error code: $Result"
|
Output "Could not stop PMS. PMS did not shutdown within 30 second limit."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return $Result
|
return $Result
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user