From 1786b20887404273415dcc70496f6d392d41696a Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 26 Mar 2023 20:28:20 -0500 Subject: [PATCH] Update mm-scripts.sh --- mm-scripts.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/mm-scripts.sh b/mm-scripts.sh index 4eff9e3..043e086 100755 --- a/mm-scripts.sh +++ b/mm-scripts.sh @@ -335,18 +335,26 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf if [ "${checkport}" != "" ]; then checked="" fi - 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" + if [ "${checked}" == "false" ] && [ ${cc} -eq 4 ]; then + if [ -f ${MMFOLDER}/mm.${srvc}.starting ]; 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 + tryupdate="true" - 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]}" + 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]}" + + rm -f ${MMFOLDER}/mm.${srvc}.starting + + else + touch ${MMFOLDER}/mm.${srvc}.starting + fi + checked="" + fi ((cc=${cc}+1)) sleep 1s