diff --git a/mm-scripts.sh b/mm-scripts.sh index 286e032..1b8081e 100755 --- a/mm-scripts.sh +++ b/mm-scripts.sh @@ -68,22 +68,31 @@ MMSTART(){ ((cc=${cc}+1)) sleep 1s done - echo -e "${idsCL[Green]} done${idsCL[Default]}" - echo -en "${idsCL[LightCyan]}${mmsv} Services... ${idsCL[Default]}" - for srvc in "${SERVICES_CHECK[@]}"; do - /bin/systemctl start ${srvc} - echo "" - done - echo -e "${idsCL[Green]} done${idsCL[Default]}" - if [ "${action}" == "start" ]; then - echo -e "${idsCL[LightCyan]}It may take a couple of minutes before all systems fully start up${idsCL[Default]}" + + + OUT=`ip a show $VPN_INTERFACE up` >/dev/null 2>&1 + if [ ${#OUT} -ne 0 ]; then + echo -e "${idsCL[Green]} done${idsCL[Default]}" + echo -en "${idsCL[LightCyan]}${mmsv} Services... ${idsCL[Default]}" + for srvc in "${SERVICES_CHECK[@]}"; do + /bin/systemctl start ${srvc} + echo "" + done + echo -e "${idsCL[Green]} done${idsCL[Default]}" + if [ "${action}" == "start" ]; then + echo -e "${idsCL[LightCyan]}It may take a couple of minutes before all systems fully start up${idsCL[Default]}" + echo + fi + rm -f /opt/mm.stop + rm -f /opt/mm.vpn.fail* + echo + echo -e "${idsCL[Green]}All services have been started${idsCL[Default]}" + else + echo -e "${idsCL[Red]} failed${idsCL[Default]}" echo + echo -e "${idsCL[Red]}Could not start the VPN, fix your shit...${idsCL[Default]}" fi - rm -f /opt/mm.stop - rm -f /opt/mm.vpn.fail* echo - echo -e "${idsCL[Green]}All services have been started${idsCL[Default]}" - echo } MMSTOP(){