Update mm-scripts.sh

This commit is contained in:
2022-06-03 18:17:06 -05:00
parent 1612db1f41
commit e557d23436

View File

@@ -102,7 +102,8 @@ MMSTART(){
checked=""
fi
if [ "${checked}" == "false" ] && [ ${cc} -eq 10 ]; then
echo -e "${idsCL[Red]}Could not confirm default routes using the VPN only!${idsCL[Default]}"
echo -e "${idsCL[Red]}Could not confirm default routes, shutting down!${idsCL[Default]}"
echo "$(date) - Could not confirm default routes, shutting down" >> $logfile
MMSTOP
exit 1
fi
@@ -111,6 +112,28 @@ MMSTART(){
done
echo -e "${idsCL[Green]} done${idsCL[Default]}"
echo -en "${idsCL[LightCyan]}Verifing traffic is routing through VPN... ${idsCL[Default]}"
checked=false
cc=0
until [ "${checked}" = "" ]; do
scip=$(dig +short sc1.scity.us @ns1.scity.us)
mmip=$(dig +short myip.opendns.com @resolver1.opendns.com)
if [ "${scip}" != "${mmip}" ]; then
checked=""
fi
if [ "${checked}" == "false" ] && [ ${cc} -eq 10 ]; then
echo -e "${idsCL[Red]}Traffic is not routing through VPN!${idsCL[Default]}"
echo "$(date) - Traffic is not routing through VPN, shutting down" >> $logfile
MMSTOP
exit 1
fi
((cc=${cc}+1))
sleep 1s
done
echo -e "${idsCL[Green]} done${idsCL[Default]}"
echo
echo -en "${idsCL[LightCyan]}${mmsv} Services... ${idsCL[Default]}"
for srvc in "${SERVICES_CHECK[@]}"; do
@@ -133,13 +156,14 @@ MMSTART(){
echo -e "${idsCL[Red]} failed${idsCL[Default]}"
echo
echo -e "${idsCL[Red]}Could not start the VPN, fix your shit...${idsCL[Default]}"
echo "$(date) - Could not start the VPN, fix your shit..." >> $logfile
fi
echo
}
MMSTOP(){
if [ -f /opt/mm.stop ]; then
echo -e "${idsCL[Yellow]}The system is already stopped, will verify anyway,..${idsCL[Default]}"
echo -e "${idsCL[Yellow]}The system is already stopped, will verify anyway...${idsCL[Default]}"
else
echo -e "${idsCL[Green]}Stopping System...${idsCL[Default]}"
echo
@@ -158,17 +182,17 @@ MMSTOP(){
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 #jackett
if ! lsof -Pi :8686 -sTCP:LISTEN -t >/dev/null; then #lidarr
if ! lsof -Pi :9117 -sTCP:LISTEN -t >/dev/null; then #jackett
checked=""
fi
fi
fi
fi
fi
fi
fi
fi
fi #/jackett
fi #/lidarr
fi #/tautulli
fi #/qbittorrent
fi #/sonarr
fi #/radarr3d
fi #/radarr
fi #/ombi
done
echo -e "${idsCL[Green]} done${idsCL[Default]}"