Update mm-scripts.sh
This commit is contained in:
@@ -44,7 +44,29 @@ unset IFS
|
|||||||
cw_spc=40
|
cw_spc=40
|
||||||
|
|
||||||
MMCRONCHECK(){
|
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
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1340,15 +1362,19 @@ USAGE(){
|
|||||||
|
|
||||||
|
|
||||||
if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
|
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
|
if [ -f ${MMFOLDER}/mm.stop ]; then
|
||||||
stoppedsince=`date +%s`-$(stat -c %Y ${MMFOLDER}/mm.stop)
|
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]}"
|
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
|
fi
|
||||||
case $action in
|
case $action in
|
||||||
start | check)
|
clear) echo -e "${idsCL[LightCyan]}Clearing all mm.* files ${idsCL[Default]}"; echo;;
|
||||||
[ "${2}" == "cron" ] && MMCRONCHECK
|
cron) MMCRONCHECK;;
|
||||||
|
setup) MMSETUP;;
|
||||||
|
vpninfo) GETVPNINFO;;
|
||||||
|
speedtest) VPNSPEEDTEST;;
|
||||||
|
|
||||||
|
stop) MMSTOP;;
|
||||||
|
start | check)
|
||||||
if [ -f ${MMFOLDER}/mm.stop ] && [ "${action}" == "check" ]; then
|
if [ -f ${MMFOLDER}/mm.stop ] && [ "${action}" == "check" ]; then
|
||||||
if [ "${2}" != "q" ]; then
|
if [ "${2}" != "q" ]; then
|
||||||
echo -e "${stopmsg}"
|
echo -e "${stopmsg}"
|
||||||
@@ -1381,9 +1407,6 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
|
|||||||
[ ! -f ${MMFOLDER}/mm.stop ] && MMSTART ${action} ${2}
|
[ ! -f ${MMFOLDER}/mm.stop ] && MMSTART ${action} ${2}
|
||||||
[ "${action}" != "status" ] && rm -f ${MMFOLDER}/mm.stop.checking
|
[ "${action}" != "status" ] && rm -f ${MMFOLDER}/mm.stop.checking
|
||||||
;;
|
;;
|
||||||
stop)
|
|
||||||
MMSTOP
|
|
||||||
;;
|
|
||||||
restart)
|
restart)
|
||||||
if [ -f ${MMFOLDER}/mm.stop ]; then
|
if [ -f ${MMFOLDER}/mm.stop ]; then
|
||||||
echo -e "${stopmsg}"
|
echo -e "${stopmsg}"
|
||||||
@@ -1404,10 +1427,9 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
|
|||||||
fi
|
fi
|
||||||
MMSTATUS ${2}
|
MMSTATUS ${2}
|
||||||
;;
|
;;
|
||||||
setup) MMSETUP;;
|
|
||||||
vpninfo) GETVPNINFO;;
|
|
||||||
speedtest) VPNSPEEDTEST;;
|
|
||||||
update);;
|
update);;
|
||||||
|
update-list) SHOWSRVCUPDATES;;
|
||||||
update-service) UPDATESERVICE ${2};;
|
update-service) UPDATESERVICE ${2};;
|
||||||
update-allservices)
|
update-allservices)
|
||||||
# for usrvc in "${SERVICES_CHECK[@]}"; do
|
# for usrvc in "${SERVICES_CHECK[@]}"; do
|
||||||
@@ -1415,8 +1437,7 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
|
|||||||
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE ${usrvc} ${2}
|
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE ${usrvc} ${2}
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
update-list) SHOWSRVCUPDATES;;
|
|
||||||
clear) echo -e "${idsCL[LightCyan]}Clearing all mm.* files ${idsCL[Default]}"; echo;;
|
|
||||||
*) USAGE;;
|
*) USAGE;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user