Update mm-scripts.sh

This commit is contained in:
2023-03-23 21:55:21 -05:00
parent ad38830934
commit 285947c169

View File

@@ -489,10 +489,16 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
case $action in case $action in
start | check) start | check)
if [ -f ${MMFOLDER}/mm.stop* ] && [ "${action}" == "check" ]; then if [ -f ${MMFOLDER}/mm.stop* ] && [ "${action}" == "check" ]; then
if [ -f ${MMFOLDER}/mm.stop.checking ]; then echo -e "${stopmsg}"
echo 'yes' # [ $VERBOSE = true ] && echo "$(date) - Not checking, system has been stopped" >> $logfile
echo ${MMFOLDER} echo
exit 1
elif [ "${VPN_USER}" == "" ] || [ "${VPN_PASS}" == "" ] || [ "${VPN_SERVER}" == "" ]; then
echo "$(date) - VPN User Info Missing" >> $logfile
echo -e "${idsCL[Red]}VPN User Info Missing${idsCL[Default]}"
echo
exit 1
elif [ ! -f ${MMFOLDER}/mm.stop ] && [ -f ${MMFOLDER}/mm.stop.checking ]; then
checkstopped=`expr $(date +%s) - $(stat -c %Y ${MMFOLDER}/mm.stop.checking)` checkstopped=`expr $(date +%s) - $(stat -c %Y ${MMFOLDER}/mm.stop.checking)`
if [ $checkstopped -gt 900 ]; then if [ $checkstopped -gt 900 ]; then
rm -f ${MMFOLDER}/mm.stop* rm -f ${MMFOLDER}/mm.stop*
@@ -501,29 +507,19 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
/bin/kill $i /bin/kill $i
done done
echo "$(date) - Bash script stuck in stop mode after doing a check" >> $logfile echo "$(date) - Bash script stuck in stop mode after doing a check" >> $logfile
SENDNOTICE "MM Script Error" "Bash script stuck in stop mode after doing a check" SENDNOTICE "MM Script Error" "Bash script stuck in check mode"
else else
exit 1 exit 1
fi fi
else
echo -e "${stopmsg}"
# [ $VERBOSE = true ] && echo "$(date) - Not checking, system has been stopped" >> $logfile
echo
exit 1
fi fi
elif [ "${VPN_USER}" == "" ] || [ "${VPN_PASS}" == "" ] || [ "${VPN_SERVER}" == "" ]; then [ "${action}" != "status" ] && touch ${MMFOLDER}/mm.stop.checking
echo "$(date) - VPN User Info Missing" >> $logfile MMSTART ${action} ${2}
echo -e "${idsCL[Red]}VPN User Info Missing${idsCL[Default]}" [ "${action}" != "status" ] && rm -f ${MMFOLDER}/mm.stop.checking
echo ;;
exit 1
fi
# touch ${MMFOLDER}/mm.stop
[ "${action}" = "check" ] && touch ${MMFOLDER}/mm.stop.checking
MMSTART ${action} ${2};;
stop) stop)
MMSTOP;; MMSTOP
;;
restart) restart)
if [ -f ${MMFOLDER}/mm.stop ]; then if [ -f ${MMFOLDER}/mm.stop ]; then
@@ -535,18 +531,21 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
echo -en "${idsCL[LightCyan]}Pausing for 10secs... ${idsCL[Default]}" echo -en "${idsCL[LightCyan]}Pausing for 10secs... ${idsCL[Default]}"
sleep 10s sleep 10s
echo -e "${idsCL[Green]}Done${idsCL[Default]}" echo -e "${idsCL[Green]}Done${idsCL[Default]}"
MMSTART ${action};; MMSTART ${action}
;;
status) status)
if [ -f ${MMFOLDER}/mm.stop ]; then if [ -f ${MMFOLDER}/mm.stop ]; then
echo -e "${stopmsg}" echo -e "${stopmsg}"
echo echo
fi fi
MMSTATUS ${2};; MMSTATUS ${2}
;;
update);; update);;
clear) echo -e "${idsCL[LightCyan]}Clearing all mm.* files ${idsCL[Default]}" clear) echo -e "${idsCL[LightCyan]}Clearing all mm.* files ${idsCL[Default]}"
echo;; echo
;;
*) *)
echo -e " Usage: ${idsCL[LightCyan]}mm {option}${idsCL[Default]}" echo -e " Usage: ${idsCL[LightCyan]}mm {option}${idsCL[Default]}"