This commit is contained in:
2025-05-28 21:27:58 -05:00
parent 4b3d0d7d10
commit c4a8f5465b
3 changed files with 16 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERS='3.10.6-05282025' VERS='3.10.7-05282025'
MMFOLDER="/opt/idssys/mediamanager" MMFOLDER="/opt/idssys/mediamanager"
TMPFOLDER="${MMFOLDER}/.tmp" TMPFOLDER="${MMFOLDER}/.tmp"
@@ -9,8 +9,8 @@ LOGFOLDER="${MMFOLDER}/logs"
[ ! -d ${LOGFOLDER} ] && mkdir ${LOGFOLDER} [ ! -d ${LOGFOLDER} ] && mkdir ${LOGFOLDER}
MMSRV=$(/bin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) MMSRV=$(/bin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
NM_FOLDER="/opt/idssys/nodemgmt" # NM_FOLDER="/opt/idssys/nodemgmt"
[ -f ${NM_FOLDER}/conf/defaults.local.inc ] && source ${NM_FOLDER}/defaults.inc # [ -f ${NM_FOLDER}/conf/defaults.local.inc ] && source ${NM_FOLDER}/defaults.inc
AVAILSERVICES=bazarr,jackett,lidarr,ombi,snap.overseerr.daemon,prowlarr,qbittorrent,radarr,radarr3d,readarr,sonarr,snap.tautulli.tautulli AVAILSERVICES=bazarr,jackett,lidarr,ombi,snap.overseerr.daemon,prowlarr,qbittorrent,radarr,radarr3d,readarr,sonarr,snap.tautulli.tautulli

View File

@@ -139,7 +139,7 @@ MMSTART(){
# "${VPN_START[@]}" >/dev/null 2>&1 # "${VPN_START[@]}" >/dev/null 2>&1
# sleep 10s # sleep 10s
rm -f ${TMPFOLDER}/mm.stop* rm -f ${TMPFOLDER}/mm.stop*
rm -f ${NM_FOLDER}/.tmp/mm.stop* # rm -f ${NM_FOLDER}/.tmp/mm.stop*
[ $VERBOSE = true ] && DEBUGLOGSTOP [ $VERBOSE = true ] && DEBUGLOGSTOP
exit 1 exit 1
elif [ -f ${TMPFOLDER}/mm.vpn.fail2 ]; then elif [ -f ${TMPFOLDER}/mm.vpn.fail2 ]; then
@@ -159,7 +159,7 @@ MMSTART(){
# "${VPN_START[@]}" >/dev/null 2>&1 # "${VPN_START[@]}" >/dev/null 2>&1
# sleep 10s # sleep 10s
rm -f ${TMPFOLDER}/mm.stop* rm -f ${TMPFOLDER}/mm.stop*
rm -f ${NM_FOLDER}/.tmp/mm.stop* # rm -f ${NM_FOLDER}/.tmp/mm.stop*
[ $VERBOSE = true ] && DEBUGLOGSTOP [ $VERBOSE = true ] && DEBUGLOGSTOP
exit 1 exit 1
fi fi
@@ -275,7 +275,7 @@ MMSTART(){
# "${VPN_START[@]}" >/dev/null 2>&1 # "${VPN_START[@]}" >/dev/null 2>&1
# sleep 10s # sleep 10s
rm -f ${TMPFOLDER}/mm.stop* rm -f ${TMPFOLDER}/mm.stop*
rm -f ${NM_FOLDER}/.tmp/mm.stop* # rm -f ${NM_FOLDER}/.tmp/mm.stop*
[ $VERBOSE = true ] && DEBUGLOGSTOP [ $VERBOSE = true ] && DEBUGLOGSTOP
exit 1 exit 1
fi fi
@@ -307,7 +307,7 @@ MMSTART(){
# "${VPN_START[@]}" >/dev/null 2>&1 # "${VPN_START[@]}" >/dev/null 2>&1
# sleep 10s # sleep 10s
rm -f ${TMPFOLDER}/mm.stop* rm -f ${TMPFOLDER}/mm.stop*
rm -f ${NM_FOLDER}/.tmp/mm.stop* # rm -f ${NM_FOLDER}/.tmp/mm.stop*
[ $VERBOSE = true ] && DEBUGLOGSTOP [ $VERBOSE = true ] && DEBUGLOGSTOP
exit 1 exit 1
fi fi
@@ -329,7 +329,7 @@ MMSTART(){
# "${VPN_START[@]}" >/dev/null 2>&1 # "${VPN_START[@]}" >/dev/null 2>&1
# sleep 10s # sleep 10s
rm -f ${TMPFOLDER}/mm.stop* rm -f ${TMPFOLDER}/mm.stop*
rm -f ${NM_FOLDER}/.tmp/mm.stop* # rm -f ${NM_FOLDER}/.tmp/mm.stop*
[ $VERBOSE = true ] && DEBUGLOGSTOP [ $VERBOSE = true ] && DEBUGLOGSTOP
exit 1 exit 1
fi fi
@@ -499,7 +499,7 @@ MMSTART(){
rm -f ${TMPFOLDER}/mm.vpn.fail* rm -f ${TMPFOLDER}/mm.vpn.fail*
fi fi
rm -f ${TMPFOLDER}/mm.stop* rm -f ${TMPFOLDER}/mm.stop*
rm -f ${NM_FOLDER}/.tmp/mm.stop* # rm -f ${NM_FOLDER}/.tmp/mm.stop*
echo -e "${idsCL[Green]}All systems are go!${idsCL[Default]}" echo -e "${idsCL[Green]}All systems are go!${idsCL[Default]}"
fi fi
@@ -519,7 +519,7 @@ MMSTOP(){
fi fi
echo echo
touch ${TMPFOLDER}/mm.stop touch ${TMPFOLDER}/mm.stop
touch ${NM_FOLDER}/.tmp/mm.stop # touch ${NM_FOLDER}/.tmp/mm.stop
# echo -en "${idsCL[LightCyan]}Stopping background MM scripts... ${idsCL[Default]}" # echo -en "${idsCL[LightCyan]}Stopping background MM scripts... ${idsCL[Default]}"
# getMMbash=$(pgrep -f '/mm') # getMMbash=$(pgrep -f '/mm')
@@ -606,7 +606,7 @@ MMSTOP(){
fi fi
echo echo
touch ${TMPFOLDER}/mm.stop touch ${TMPFOLDER}/mm.stop
touch ${NM_FOLDER}/.tmp/mm.stop # touch ${NM_FOLDER}/.tmp/mm.stop
} }
FULLSTOP(){ FULLSTOP(){
echo -en "${idsCL[LightCyan]}Stopping any background MM scripts still running... ${idsCL[Default]}" echo -en "${idsCL[LightCyan]}Stopping any background MM scripts still running... ${idsCL[Default]}"
@@ -1759,12 +1759,12 @@ if [ ! -f ${TMPFOLDER}/mm.update.stop ]; then
checkstopped=`expr $(date +%s) - $(stat -c %Y ${TMPFOLDER}/mm.stop.checking)` checkstopped=`expr $(date +%s) - $(stat -c %Y ${TMPFOLDER}/mm.stop.checking)`
if [ $checkstopped -gt 900 ]; then if [ $checkstopped -gt 900 ]; then
rm -f ${TMPFOLDER}/mm.stop* rm -f ${TMPFOLDER}/mm.stop*
rm -f ${NM_FOLDER}/.tmp/mm.stop* # rm -f ${NM_FOLDER}/.tmp/mm.stop*
echo "$(date) - Bash script stuck in stop mode after doing a check, will restart" >> ${MM_LOGFILE} echo "$(date) - Bash script stuck in stop mode after doing a check, will restart" >> ${MM_LOGFILE}
SENDNOTICE "MM Script Error" "Bash script stuck in check mode, restarting system" SENDNOTICE "MM Script Error" "Bash script stuck in check mode, restarting system"
MMSTOP MMSTOP
rm -f ${TMPFOLDER}/mm.stop* rm -f ${TMPFOLDER}/mm.stop*
rm -f ${NM_FOLDER}/.tmp/mm.stop* # rm -f ${NM_FOLDER}/.tmp/mm.stop*
getStuckMM=$(pgrep -f '/mm') getStuckMM=$(pgrep -f '/mm')
for i in $getStuckMM; do for i in $getStuckMM; do
/bin/kill $i /bin/kill $i

6
run.sh
View File

@@ -86,17 +86,17 @@ if [ "${1}" == "clear" ]; then
else else
rm -f ${TMPFOLDER}/* rm -f ${TMPFOLDER}/*
touch ${TMPFOLDER}/mm.stop touch ${TMPFOLDER}/mm.stop
touch ${NM_FOLDER}/.tmp/mm.stop # touch ${NM_FOLDER}/.tmp/mm.stop
fi fi
fi fi
if [ -f ${TMPFOLDER}/mm.stop.checking ]; then if [ -f ${TMPFOLDER}/mm.stop.checking ]; then
#fd=$(expr $(date +%s) - $(stat -L --format %Y ${TMPFOLDER}/mm.stop.checking)) #fd=$(expr $(date +%s) - $(stat -L --format %Y ${TMPFOLDER}/mm.stop.checking))
if [ $(expr $(date +%s) - $(stat -L --format %Y ${TMPFOLDER}/mm.stop.checking)) -gt 900 ]; then if [ $(expr $(date +%s) - $(stat -L --format %Y ${TMPFOLDER}/mm.stop.checking)) -gt 900 ]; then
rm -f ${TMPFOLDER}/mm.stop* rm -f ${TMPFOLDER}/mm.stop*
rm -f ${NM_FOLDER}/.tmp/mm.stop* # rm -f ${NM_FOLDER}/.tmp/mm.stop*
elif [ "${1}" = "check" ] && [ "$(ip link | grep "${VPN_INTERFACE}")" = "" ] && [ ! -f ${TMPFOLDER}/mm.vpn* ] && [ $(uptime_minutes) -lt 3 ]; then elif [ "${1}" = "check" ] && [ "$(ip link | grep "${VPN_INTERFACE}")" = "" ] && [ ! -f ${TMPFOLDER}/mm.vpn* ] && [ $(uptime_minutes) -lt 3 ]; then
rm -f ${TMPFOLDER}/mm.stop* rm -f ${TMPFOLDER}/mm.stop*
rm -f ${NM_FOLDER}/.tmp/mm.stop* # rm -f ${NM_FOLDER}/.tmp/mm.stop*
elif [[ "${allowrun}" != *" ${1} "* ]] && [ "${1}" != "" ]; then elif [[ "${allowrun}" != *" ${1} "* ]] && [ "${1}" != "" ]; then
echo -e "${idsCL[LightCyan]}Try again later, 'mm' program currently in use...${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Try again later, 'mm' program currently in use...${idsCL[Default]}"