Update mm-scripts.sh

This commit is contained in:
2023-04-21 18:41:01 -05:00
parent 28ff3d09da
commit 855b942d17

View File

@@ -276,7 +276,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
### CHECK FOR PLEX MOUNT
files=$(shopt -s nullglob dotglob; echo ${PLEX_MOUNT}/*)
if (( ! ${#files} )); then
if (( ! ${#files} )) && [ ! -f ${MMFOLDER}/mm.plexmount.fail2 ]; then
echo "$(date) - Plex Media Not Mounted, will try and fix" >> $logfile
umount ${PLEX_MOUNT} >/dev/null 2>&1
sleep 2s
@@ -301,7 +301,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
echo "$(date) - Plex Media could not be mounted" >> $logfile
fi
touch ${MMFOLDER}/mm.plexmount.fail
echo -e "${idsCL[Red]}Not Mounted, stopping services${idsCL[Default]}"
echo -e "${idsCL[Red]}Not Mounted${idsCL[Default]}"
for srvc in "${SERVICES_CHECK[@]}"; do
/bin/systemctl stop ${srvc} >/dev/null 2>&1 &
done
@@ -314,11 +314,30 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
/bin/systemctl stop ${srvc} >/dev/null 2>&1 &
done
fi
elif [ -f ${MMFOLDER}/mm.plexmount.fail2 ]; then
mount -a >/dev/null 2>&1
echo -e "${idsCL[Red]}Not Mounted, but running services anyway as chosen previously${idsCL[Default]}"
else
echo -e "${idsCL[Green]}Mounted${idsCL[Default]}"
rm -f ${MMFOLDER}/mm.plexmount.fail
fi
if [ -f ${MMFOLDER}/mm.plexmount.fail ] && [ "${1}" == "start" ]; then
echo
echo -en "${idsCL[LightCyan]}Would you like to start services without Plex Media being mounted? (y/N): ${idsCL[Default]}"
read start_noplexmedia
read -n 1 -p "Would you like to start services without Plex Media being mounted? (y/N): " choice
case "$choice" in
[Yy])
rm -f ${MMFOLDER}/mm.plexmount.fail
touch ${MMFOLDER}/mm.plexmount.fail2
;;
* ) echo;;
esac
fi
[ "${1}" == "start" ] && [ "${2}" != "vpn" ] && rm -f ${MMFOLDER}/mm.noservices
if [ "${2}" != "vpn" ] && [ ! -f ${MMFOLDER}/mm.noservices ] && [ ! -f ${MMFOLDER}/mm.plexmount.fail ]; then