From 855b942d1704fc5542dea5c3ca955a71b8c2da7c Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Fri, 21 Apr 2023 18:41:01 -0500 Subject: [PATCH] Update mm-scripts.sh --- mm-scripts.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/mm-scripts.sh b/mm-scripts.sh index 760aff3..f77d03b 100755 --- a/mm-scripts.sh +++ b/mm-scripts.sh @@ -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