Update mm-scripts.sh
This commit is contained in:
@@ -489,42 +489,38 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
|
||||
case $action in
|
||||
start | check)
|
||||
if [ -f ${MMFOLDER}/mm.stop* ] && [ "${action}" == "check" ]; then
|
||||
if [ -f ${MMFOLDER}/mm.stop.checking ]; then
|
||||
echo 'yes'
|
||||
echo ${MMFOLDER}
|
||||
|
||||
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
|
||||
echo -e "${stopmsg}"
|
||||
# [ $VERBOSE = true ] && echo "$(date) - Not checking, system has been stopped" >> $logfile
|
||||
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)`
|
||||
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
|
||||
# touch ${MMFOLDER}/mm.stop
|
||||
[ "${action}" = "check" ] && touch ${MMFOLDER}/mm.stop.checking
|
||||
|
||||
MMSTART ${action} ${2};;
|
||||
[ "${action}" != "status" ] && touch ${MMFOLDER}/mm.stop.checking
|
||||
MMSTART ${action} ${2}
|
||||
[ "${action}" != "status" ] && rm -f ${MMFOLDER}/mm.stop.checking
|
||||
;;
|
||||
|
||||
stop)
|
||||
MMSTOP;;
|
||||
|
||||
MMSTOP
|
||||
;;
|
||||
|
||||
restart)
|
||||
if [ -f ${MMFOLDER}/mm.stop ]; then
|
||||
echo -e "${stopmsg}"
|
||||
@@ -535,19 +531,22 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
|
||||
echo -en "${idsCL[LightCyan]}Pausing for 10secs... ${idsCL[Default]}"
|
||||
sleep 10s
|
||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||
MMSTART ${action};;
|
||||
|
||||
MMSTART ${action}
|
||||
;;
|
||||
|
||||
status)
|
||||
if [ -f ${MMFOLDER}/mm.stop ]; then
|
||||
echo -e "${stopmsg}"
|
||||
echo
|
||||
fi
|
||||
MMSTATUS ${2};;
|
||||
|
||||
MMSTATUS ${2}
|
||||
;;
|
||||
|
||||
update);;
|
||||
clear) echo -e "${idsCL[LightCyan]}Clearing all mm.* files ${idsCL[Default]}"
|
||||
echo;;
|
||||
|
||||
echo
|
||||
;;
|
||||
|
||||
*)
|
||||
echo -e " Usage: ${idsCL[LightCyan]}mm {option}${idsCL[Default]}"
|
||||
echo
|
||||
|
||||
Reference in New Issue
Block a user