Update mm-scripts.sh

This commit is contained in:
2023-04-29 21:15:56 -05:00
parent 69488c08e2
commit 1d2589e10b

View File

@@ -44,7 +44,29 @@ unset IFS
cw_spc=40
MMCRONCHECK(){
[ -f ${MMFOLDER}/mm.stop ] && /usr/local/bin/mm check q >/dev/null 2>&1 || /usr/local/bin/mm check q >> /opt/idssys/mediamanager/logs/outputs.check.log
if [ -f ${MMFOLDER}/mm.stop ]; then
/usr/local/bin/mm check q >/dev/null 2>&1
else
echo -e "\n\n$(date) - Starting log #############################\n" >> ${outputlogfile}
/usr/local/bin/mm check q >> ${outputlogfile}
echo -e "\n$(date) - Finished log #############################" >> ${outputlogfile}
fi
if [ $(date +%H)$(date +%u) -eq 4 ] && [ $(date +%H)$(date +%M) -ge 0400 ] && [ $(date +%H)$(date +%M) -le 0405 ] ; then
versup=$(expr `date +%s` - $(stat -c %Y ${MMFOLDER}/vers.info))
if [ ${vpnuptime} -ge 600 ]; then
/usr/local/bin/mm update-allservices >/dev/null 2>&1
echo "$(date) - Updated All Services" >> $logfile
}
elif [ $(date +%H)$(date +%M) -ge 0300 ] && [ $(date +%H)$(date +%M) -le 0305 ] ; then
versup=$(expr `date +%s` - $(stat -c %Y ${MMFOLDER}/vers.info))
if [ ${vpnuptime} -ge 600 ]; then
/usr/local/bin/mm update-allservices >/dev/null 2>&1
echo "$(date) - Updated All Services" >> $logfile
}
fi
exit 0
}
@@ -1340,15 +1362,19 @@ USAGE(){
if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
[ "${2}" == "q" ] && [ "${action}" == "check" ] && [ ! -f ${MMFOLDER}/mm.stop ] && echo -e "\n\n$(date) - Starting log #############################\n" >> ${outputlogfile}
if [ -f ${MMFOLDER}/mm.stop ]; then
stoppedsince=`date +%s`-$(stat -c %Y ${MMFOLDER}/mm.stop)
stopmsg="${idsCL[Yellow]}The system has currently been stopped for '$(SHOW_TIME ${stoppedsince})'.\n${idsCL[LightCyan]}(You'll need to run \"mm start\" to start services again)${idsCL[Default]}"
fi
case $action in
start | check)
[ "${2}" == "cron" ] && MMCRONCHECK
clear) echo -e "${idsCL[LightCyan]}Clearing all mm.* files ${idsCL[Default]}"; echo;;
cron) MMCRONCHECK;;
setup) MMSETUP;;
vpninfo) GETVPNINFO;;
speedtest) VPNSPEEDTEST;;
stop) MMSTOP;;
start | check)
if [ -f ${MMFOLDER}/mm.stop ] && [ "${action}" == "check" ]; then
if [ "${2}" != "q" ]; then
echo -e "${stopmsg}"
@@ -1381,9 +1407,6 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
[ ! -f ${MMFOLDER}/mm.stop ] && MMSTART ${action} ${2}
[ "${action}" != "status" ] && rm -f ${MMFOLDER}/mm.stop.checking
;;
stop)
MMSTOP
;;
restart)
if [ -f ${MMFOLDER}/mm.stop ]; then
echo -e "${stopmsg}"
@@ -1404,10 +1427,9 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
fi
MMSTATUS ${2}
;;
setup) MMSETUP;;
vpninfo) GETVPNINFO;;
speedtest) VPNSPEEDTEST;;
update);;
update-list) SHOWSRVCUPDATES;;
update-service) UPDATESERVICE ${2};;
update-allservices)
# for usrvc in "${SERVICES_CHECK[@]}"; do
@@ -1415,8 +1437,7 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE ${usrvc} ${2}
done
;;
update-list) SHOWSRVCUPDATES;;
clear) echo -e "${idsCL[LightCyan]}Clearing all mm.* files ${idsCL[Default]}"; echo;;
*) USAGE;;
esac