Update mm-scripts.sh
This commit is contained in:
@@ -325,11 +325,35 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
|
|||||||
for srvc in "${SERVICES_CHECK[@]}"; do
|
for srvc in "${SERVICES_CHECK[@]}"; do
|
||||||
if [ "$(systemctl is-active ${srvc})" != "active" ]; then
|
if [ "$(systemctl is-active ${srvc})" != "active" ]; then
|
||||||
/bin/systemctl start ${srvc}
|
/bin/systemctl start ${srvc}
|
||||||
sleep 5s
|
|
||||||
fi
|
fi
|
||||||
checkport=$(lsof -Pi :${MM_SERVICE_PORTS[${srvc}]} -sTCP:LISTEN -t)
|
checkport=$(lsof -Pi :${MM_SERVICE_PORTS[${srvc}]} -sTCP:LISTEN -t)
|
||||||
if [ "${checkport}" == "" ] && [ "${MM_UPDATE_REPO[${srvc}]}" != "" ]; then
|
|
||||||
UPDATESERVICE {$srvc} >/dev/null 2>&1
|
checked=false
|
||||||
|
cc=0
|
||||||
|
until [ "${checked}" = "" ]; do
|
||||||
|
if [ "${checkport}" != "" ]; then
|
||||||
|
checked=""
|
||||||
|
fi
|
||||||
|
if [ "${checked}" == "false" ] && [ ${cc} -eq 15 ]; 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
|
||||||
|
checked=""
|
||||||
|
tryupdate=true
|
||||||
|
|
||||||
|
msg="Updating 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]}"
|
||||||
|
fi
|
||||||
|
((cc=${cc}+1))
|
||||||
|
sleep 1s
|
||||||
|
checkport=$(lsof -Pi :${MM_SERVICE_PORTS[${srvc}]} -sTCP:LISTEN -t)
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
if ([ "${checkport}" == "" ] || [ ${tryupdate} == true ]) && [ "${MM_UPDATE_REPO[${srvc}]}" != "" ]; then
|
||||||
|
UPDATESERVICE ${srvc} >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user