This commit is contained in:
2023-03-25 10:32:53 -05:00
parent 4fb2b85cf7
commit 87f0a20621
2 changed files with 57 additions and 36 deletions

View File

@@ -12,18 +12,30 @@ outputlogfile=${MMFOLDER}/logs/outputs.check.log
[ ! -f ${logfile} ] && touch $logfile [ ! -f ${logfile} ] && touch $logfile
[ ! -f ${outputlogfile} ] && touch $outputlogfile [ ! -f ${outputlogfile} ] && touch $outputlogfile
declare -A NM_SERVICES declare -A MM_SERVICES
NM_SERVICES['openvpn']='OpenVPN (TorGuard VPN Tunnel)' MM_SERVICES['openvpn']='OpenVPN (TorGuard VPN Tunnel)'
NM_SERVICES['wireguard']='WireGuard (TorGuard VPN Tunnel)' MM_SERVICES['wireguard']='WireGuard (TorGuard VPN Tunnel)'
NM_SERVICES['lidarr']='Lidarr (Music Manager)' MM_SERVICES['lidarr']='Lidarr (Music Manager)'
NM_SERVICES['radarr']='Radarr (Movie Manager)' MM_SERVICES['radarr']='Radarr (Movie Manager)'
NM_SERVICES['radarr3d']='Radarr3D (3D Movie Manager)' MM_SERVICES['radarr3d']='Radarr3D (3D Movie Manager)'
NM_SERVICES['sonarr']='Sonarr (TV Show Manager)' MM_SERVICES['sonarr']='Sonarr (TV Show Manager)'
NM_SERVICES['bazarr']='Bazarr (Subtitle Manager)' MM_SERVICES['bazarr']='Bazarr (Subtitle Manager)'
NM_SERVICES['jackett']='Jackett (Torrent Indexing Manager)' MM_SERVICES['jackett']='Jackett (Torrent Indexing Manager)'
NM_SERVICES['qbittorrent']='qBittorrent (Torrent Downloader)' MM_SERVICES['qbittorrent']='qBittorrent (Torrent Downloader)'
NM_SERVICES['snap.tautulli.tautulli']='Tautulli (Plex Stats)' MM_SERVICES['snap.tautulli.tautulli']='Tautulli (Plex Stats)'
NM_SERVICES['ombi']='Ombi (Download Requester)' 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 if [ "${VPN_INTERFACE}" = "tun0" ]; then #openvpn
VPN_START=(/bin/systemctl start openvpn) VPN_START=(/bin/systemctl start openvpn)

View File

@@ -377,33 +377,42 @@ MMSTOP(){
c=0; spc=''; spc1=$((${cw_spc}-${#msg})) c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
echo -en "${idsCL[LightCyan]}${msg}${spc}: ${idsCL[Default]}" echo -en "${idsCL[LightCyan]}${msg}${spc}: ${idsCL[Default]}"
echo
#for srvc in "${SERVICES_CHECK[@]}"; do #for srvc in "${SERVICES_CHECK[@]}"; do
for i in "${!NM_SERVICES[@]}"; do for srvc in "${!MM_SERVICES[@]}"; do
srvc=${NM_SERVICES[$i]} if [[ ${srvc} != *"vpn"* ]] && [[ ${srvc} != *"wireguard"* ]]; then
if [[ ${i} != *"vpn"* ]] && [[ ${i} != *"wireguard"* ]]; then /bin/systemctl stop ${srvc} &
/bin/systemctl stop ${i} &
fi fi
done done
checked=false checked=false
until [ "${checked}" = "" ]; do 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 for srvc in "${SERVICES_CHECK[@]}"; do
if ! lsof -Pi :5556 -sTCP:LISTEN -t >/dev/null; then #radarr3d echo "$srvc : ${MM_SERVICE_PORTS[${srvc}]}"
if ! lsof -Pi :5656 -sTCP:LISTEN -t >/dev/null; then #sonarr if ! lsof -Pi :${MM_SERVICE_PORTS[${srvc}]} -sTCP:LISTEN -t >/dev/null; then
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="" checked=""
fi #/jackett else
fi #/lidarr checked=false
fi #/tautulli fi
fi #/qbittorrent done
fi #/sonarr # if ! lsof -Pi :5000 -sTCP:LISTEN -t >/dev/null; then #ombi
fi #/radarr3d # if ! lsof -Pi :5555 -sTCP:LISTEN -t >/dev/null; then #radarr
fi #/radarr # if ! lsof -Pi :5556 -sTCP:LISTEN -t >/dev/null; then #radarr3d
fi #/ombi # 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 done
echo -e "${idsCL[Green]}done${idsCL[Default]}" echo -e "${idsCL[Green]}done${idsCL[Default]}"
@@ -453,9 +462,9 @@ MMSTATUS(){
echo echo
for srvc in "${statusArray[@]}"; do for srvc in "${statusArray[@]}"; do
c=0; spc='' 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 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 [ "$(systemctl is-active ${srvc})" != "active" ] && [ "${srvc}" != "wireguard" ]; then
if [ -f ${MMFOLDER}/mm.noservices ]; then if [ -f ${MMFOLDER}/mm.noservices ]; then
@@ -503,7 +512,7 @@ MMSTATUS(){
echo echo
MMSTART MMSTART
msg=" ${NM_SERVICES[wireguard]}" msg=" ${MM_SERVICES[wireguard]}"
c=0; spc=''; spc1=$((${cw_spc}-${#msg})) c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
echo -en "${idsCL[LightCyan]}${msg}${spc}: ${idsCL[Default]}" echo -en "${idsCL[LightCyan]}${msg}${spc}: ${idsCL[Default]}"