From 286b6fdca4717556958c061f8bfc3a45916e44b8 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 26 Mar 2023 20:23:34 -0500 Subject: [PATCH] Update mm-scripts.sh --- mm-scripts.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm-scripts.sh b/mm-scripts.sh index 60b6e13..4eff9e3 100755 --- a/mm-scripts.sh +++ b/mm-scripts.sh @@ -323,9 +323,8 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf echo -en "${idsCL[LightCyan]}${msg}${spc} ${idsCL[White]}: ${idsCL[Default]}" for srvc in "${SERVICES_CHECK[@]}"; do - if [ "$(systemctl is-active ${srvc})" != "active" ]; then - /bin/systemctl start ${srvc} - fi + [ "$(systemctl is-active ${srvc})" != "active" ] && /bin/systemctl start ${srvc} + if [ "${MM_SERVICE_PORTS[${srvc}]}" != "" ]; then checkport=$(lsof -Pi :${MM_SERVICE_PORTS[${srvc}]} -sTCP:LISTEN -t) @@ -336,14 +335,15 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf if [ "${checkport}" != "" ]; then checked="" fi - if [ "${checked}" == "false" ] && [ ${cc} -eq 6 ]; then - echo -e "${idsCL[Red]}${srvc} Service is not starting properly, will try and update${idsCL[Default]}" - echo "$(date) - ${srvc} Service is not starting properly, will try and update" >> $logfile - SENDNOTICE "${srvc} Service Issue" "${srvc} Service is not starting properly, will try and update" 1 + if [ "${checked}" == "false" ] && [ ${cc} -eq 10 ]; then + msg="${srvc^} Service is not starting properly, will try and update" + echo -e "${idsCL[Red]}${msg}${idsCL[Default]}" + echo "$(date) - ${msg}" >> $logfile + SENDNOTICE "${srvc^} Service Issue" "${msg}" 1 checked="" tryupdate="true" - msg="Updating ${srvc} Service" + msg="Updating ${srvc^} Service" 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[White]}: ${idsCL[Default]}"