From 87f0a206214fb03f81e79941c5fe8eaab9caa1fe Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 25 Mar 2023 10:32:53 -0500 Subject: [PATCH] update --- defaults.inc | 36 +++++++++++++++++++++----------- mm-scripts.sh | 57 +++++++++++++++++++++++++++++---------------------- 2 files changed, 57 insertions(+), 36 deletions(-) diff --git a/defaults.inc b/defaults.inc index 27ceb97..03c2655 100755 --- a/defaults.inc +++ b/defaults.inc @@ -12,18 +12,30 @@ outputlogfile=${MMFOLDER}/logs/outputs.check.log [ ! -f ${logfile} ] && touch $logfile [ ! -f ${outputlogfile} ] && touch $outputlogfile -declare -A NM_SERVICES -NM_SERVICES['openvpn']='OpenVPN (TorGuard VPN Tunnel)' -NM_SERVICES['wireguard']='WireGuard (TorGuard VPN Tunnel)' -NM_SERVICES['lidarr']='Lidarr (Music Manager)' -NM_SERVICES['radarr']='Radarr (Movie Manager)' -NM_SERVICES['radarr3d']='Radarr3D (3D Movie Manager)' -NM_SERVICES['sonarr']='Sonarr (TV Show Manager)' -NM_SERVICES['bazarr']='Bazarr (Subtitle Manager)' -NM_SERVICES['jackett']='Jackett (Torrent Indexing Manager)' -NM_SERVICES['qbittorrent']='qBittorrent (Torrent Downloader)' -NM_SERVICES['snap.tautulli.tautulli']='Tautulli (Plex Stats)' -NM_SERVICES['ombi']='Ombi (Download Requester)' +declare -A MM_SERVICES +MM_SERVICES['openvpn']='OpenVPN (TorGuard VPN Tunnel)' +MM_SERVICES['wireguard']='WireGuard (TorGuard VPN Tunnel)' +MM_SERVICES['lidarr']='Lidarr (Music Manager)' +MM_SERVICES['radarr']='Radarr (Movie Manager)' +MM_SERVICES['radarr3d']='Radarr3D (3D Movie Manager)' +MM_SERVICES['sonarr']='Sonarr (TV Show Manager)' +MM_SERVICES['bazarr']='Bazarr (Subtitle Manager)' +MM_SERVICES['jackett']='Jackett (Torrent Indexing Manager)' +MM_SERVICES['qbittorrent']='qBittorrent (Torrent Downloader)' +MM_SERVICES['snap.tautulli.tautulli']='Tautulli (Plex Stats)' +MM_SERVICES['ombi']='Ombi (Download Requester)' + +declare -A MM_SERVICE_PORTS +MM_SERVICE_PORTS['ombi']='5000' +MM_SERVICE_PORTS['radarr']='5555' +MM_SERVICE_PORTS['radarr3d']='5556' +MM_SERVICE_PORTS['sonarr']='5656' +MM_SERVICE_PORTS['qbittorrent']='5858' +MM_SERVICE_PORTS['snap.tautulli.tautulli']='8181' +MM_SERVICE_PORTS['lidarr']='8686' +MM_SERVICE_PORTS['jackett']='9117' +MM_SERVICE_PORTS['bazarr']='6767' + if [ "${VPN_INTERFACE}" = "tun0" ]; then #openvpn VPN_START=(/bin/systemctl start openvpn) diff --git a/mm-scripts.sh b/mm-scripts.sh index ccbfd6b..6d26520 100755 --- a/mm-scripts.sh +++ b/mm-scripts.sh @@ -377,33 +377,42 @@ MMSTOP(){ c=0; spc=''; spc1=$((${cw_spc}-${#msg})) until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done echo -en "${idsCL[LightCyan]}${msg}${spc}: ${idsCL[Default]}" + echo #for srvc in "${SERVICES_CHECK[@]}"; do - for i in "${!NM_SERVICES[@]}"; do - srvc=${NM_SERVICES[$i]} - if [[ ${i} != *"vpn"* ]] && [[ ${i} != *"wireguard"* ]]; then - /bin/systemctl stop ${i} & + for srvc in "${!MM_SERVICES[@]}"; do + if [[ ${srvc} != *"vpn"* ]] && [[ ${srvc} != *"wireguard"* ]]; then + /bin/systemctl stop ${srvc} & fi done checked=false until [ "${checked}" = "" ]; do - if ! lsof -Pi :5000 -sTCP:LISTEN -t >/dev/null; then #ombi - if ! lsof -Pi :5555 -sTCP:LISTEN -t >/dev/null; then #radarr - if ! lsof -Pi :5556 -sTCP:LISTEN -t >/dev/null; then #radarr3d - if ! lsof -Pi :5656 -sTCP:LISTEN -t >/dev/null; then #sonarr - if ! lsof -Pi :5858 -sTCP:LISTEN -t >/dev/null; then #qbittorrent - if ! lsof -Pi :8181 -sTCP:LISTEN -t >/dev/null; then #tautulli - if ! lsof -Pi :8686 -sTCP:LISTEN -t >/dev/null; then #lidarr - if ! lsof -Pi :9117 -sTCP:LISTEN -t >/dev/null; then #jackett - checked="" - fi #/jackett - fi #/lidarr - fi #/tautulli - fi #/qbittorrent - fi #/sonarr - fi #/radarr3d - fi #/radarr - fi #/ombi + + for srvc in "${SERVICES_CHECK[@]}"; do + echo "$srvc : ${MM_SERVICE_PORTS[${srvc}]}" + if ! lsof -Pi :${MM_SERVICE_PORTS[${srvc}]} -sTCP:LISTEN -t >/dev/null; then + checked="" + else + checked=false + fi + done + # if ! lsof -Pi :5000 -sTCP:LISTEN -t >/dev/null; then #ombi + # if ! lsof -Pi :5555 -sTCP:LISTEN -t >/dev/null; then #radarr + # if ! lsof -Pi :5556 -sTCP:LISTEN -t >/dev/null; then #radarr3d + # if ! lsof -Pi :5656 -sTCP:LISTEN -t >/dev/null; then #sonarr + # if ! lsof -Pi :5858 -sTCP:LISTEN -t >/dev/null; then #qbittorrent + # if ! lsof -Pi :8181 -sTCP:LISTEN -t >/dev/null; then #tautulli + # if ! lsof -Pi :8686 -sTCP:LISTEN -t >/dev/null; then #lidarr + # if ! lsof -Pi :9117 -sTCP:LISTEN -t >/dev/null; then #jackett + # checked="" + # fi #/jackett + # fi #/lidarr + # fi #/tautulli + # fi #/qbittorrent + # fi #/sonarr + # fi #/radarr3d + # fi #/radarr + # fi #/ombi done echo -e "${idsCL[Green]}done${idsCL[Default]}" @@ -453,9 +462,9 @@ MMSTATUS(){ echo for srvc in "${statusArray[@]}"; do c=0; spc='' - spc1=$((${cw_spc}-${#NM_SERVICES[${srvc}]})) + spc1=$((${cw_spc}-${#MM_SERVICES[${srvc}]})) until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done - echo -en " ${NM_SERVICES[${srvc}]}$spc: " + echo -en " ${MM_SERVICES[${srvc}]}$spc: " if [ "$(systemctl is-active ${srvc})" != "active" ] && [ "${srvc}" != "wireguard" ]; then if [ -f ${MMFOLDER}/mm.noservices ]; then @@ -503,7 +512,7 @@ MMSTATUS(){ echo MMSTART - msg=" ${NM_SERVICES[wireguard]}" + msg=" ${MM_SERVICES[wireguard]}" c=0; spc=''; spc1=$((${cw_spc}-${#msg})) until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done echo -en "${idsCL[LightCyan]}${msg}${spc}: ${idsCL[Default]}"