Update mm-scripts.sh
This commit is contained in:
@@ -489,42 +489,38 @@ 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
|
||||||
checkstopped=`expr $(date +%s) - $(stat -c %Y ${MMFOLDER}/mm.stop.checking)`
|
|
||||||
if [ $checkstopped -gt 900 ]; then
|
|
||||||
rm -f ${MMFOLDER}/mm.stop*
|
|
||||||
getStuckMM=$(pgrep -f '/mm')
|
|
||||||
for i in $getStuckMM; do
|
|
||||||
/bin/kill $i
|
|
||||||
done
|
|
||||||
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"
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "${stopmsg}"
|
|
||||||
# [ $VERBOSE = true ] && echo "$(date) - Not checking, system has been stopped" >> $logfile
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
elif [ "${VPN_USER}" == "" ] || [ "${VPN_PASS}" == "" ] || [ "${VPN_SERVER}" == "" ]; then
|
elif [ "${VPN_USER}" == "" ] || [ "${VPN_PASS}" == "" ] || [ "${VPN_SERVER}" == "" ]; then
|
||||||
echo "$(date) - VPN User Info Missing" >> $logfile
|
echo "$(date) - VPN User Info Missing" >> $logfile
|
||||||
echo -e "${idsCL[Red]}VPN User Info Missing${idsCL[Default]}"
|
echo -e "${idsCL[Red]}VPN User Info Missing${idsCL[Default]}"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
|
elif [ ! -f ${MMFOLDER}/mm.stop ] && [ -f ${MMFOLDER}/mm.stop.checking ]; then
|
||||||
|
checkstopped=`expr $(date +%s) - $(stat -c %Y ${MMFOLDER}/mm.stop.checking)`
|
||||||
|
if [ $checkstopped -gt 900 ]; then
|
||||||
|
rm -f ${MMFOLDER}/mm.stop*
|
||||||
|
getStuckMM=$(pgrep -f '/mm')
|
||||||
|
for i in $getStuckMM; do
|
||||||
|
/bin/kill $i
|
||||||
|
done
|
||||||
|
echo "$(date) - Bash script stuck in stop mode after doing a check" >> $logfile
|
||||||
|
SENDNOTICE "MM Script Error" "Bash script stuck in check mode"
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
# touch ${MMFOLDER}/mm.stop
|
[ "${action}" != "status" ] && touch ${MMFOLDER}/mm.stop.checking
|
||||||
[ "${action}" = "check" ] && touch ${MMFOLDER}/mm.stop.checking
|
MMSTART ${action} ${2}
|
||||||
|
[ "${action}" != "status" ] && rm -f ${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
|
||||||
echo -e "${stopmsg}"
|
echo -e "${stopmsg}"
|
||||||
@@ -535,19 +531,22 @@ 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]}"
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in New Issue
Block a user