Update mm-scripts.sh

This commit is contained in:
2024-09-30 20:15:57 -05:00
parent e9a2da7e2a
commit 8e045287e5

View File

@@ -41,19 +41,21 @@ MMCRONCHECK(){
[ ${#OUT} = 0 ] && /bin/ip route add default via ${DEFAULT_GW}
fi
if [ $(date +%u) -eq 6 ] && [ $(date +%H)$(date +%M) -ge 0400 ] && [ $(date +%H)$(date +%M) -le 0405 ] ; then
if [ $(expr `date +%s` - $(stat -c %Y ${TMPFOLDER}/vers.info)) -gt 600 ]; then
UPDATESERVICE service all q >/dev/null 2>&1
echo "$(date) - Updated All Services" >> ${MM_LOGFILE}
fi
elif [ $(date +%H)$(date +%u) -eq 6 ] && [ $(date +%H)$(date +%M) -ge 0300 ] && [ $(date +%H)$(date +%M) -lt 0305 ] ; then
if [ $(expr `date +%s` - $(stat -c %Y ${MMFOLDER}/.git/ORIG_HEAD)) -gt 600 ] && [ "`git -C /opt/idssys/nodemgmt log --pretty=%H ...refs/heads/${GBRANCH}^ | head -n 1`" != "`git -C /opt/idssys/nodemgmt ls-remote origin -h refs/heads/${GBRANCH} |cut -f1`" ]; then
echo "updating mm executing"
/usr/local/bin/mm update q >/dev/null 2>&1
source /opt/idssys/mediamanager/defaults.inc
echo "$(date) - Updated MM Scripts to v${VERS}" >> ${MM_LOGFILE}
fi
if [ "${SERVICESCHECK}" != "" ]; then
if [ $(date +%u) -eq 6 ] && [ $(date +%H)$(date +%M) -ge 0400 ] && [ $(date +%H)$(date +%M) -le 0405 ] ; then
if [ $(expr `date +%s` - $(stat -c %Y ${TMPFOLDER}/vers.info)) -gt 600 ]; then
UPDATESERVICE service all q >/dev/null 2>&1
echo "$(date) - Updated All Services" >> ${MM_LOGFILE}
fi
elif [ $(date +%H)$(date +%u) -eq 6 ] && [ $(date +%H)$(date +%M) -ge 0300 ] && [ $(date +%H)$(date +%M) -lt 0305 ] ; then
if [ $(expr `date +%s` - $(stat -c %Y ${MMFOLDER}/.git/ORIG_HEAD)) -gt 600 ] && [ "`git -C /opt/idssys/nodemgmt log --pretty=%H ...refs/heads/${GBRANCH}^ | head -n 1`" != "`git -C /opt/idssys/nodemgmt ls-remote origin -h refs/heads/${GBRANCH} |cut -f1`" ]; then
echo "updating mm executing"
/usr/local/bin/mm update q >/dev/null 2>&1
source /opt/idssys/mediamanager/defaults.inc
echo "$(date) - Updated MM Scripts to v${VERS}" >> ${MM_LOGFILE}
fi
fi
fi
if [ -f ${TMPFOLDER}/mm.stop ]; then
@@ -70,7 +72,7 @@ MMCRONCHECK(){
MMSTART(){
[ $VERBOSE = true ] && chktmstart=`date +%s`
([ "${1}" == "start" ] || [ "${1}" == "check" ]) && touch ${TMPFOLDER}/mm.stop.checking
[ "${2}" == "vpn" ] && touch ${TMPFOLDER}/mm.noservices
([ "${2}" == "vpn" ] || [ -f ${MMFOLDER}/mm.noservices ]) && touch ${TMPFOLDER}/mm.noservices
if [ "${1}" = "start" ] || [ "${1}" = "restart" ] || [ "${1}" = "" ]; then
GOFORSTART=true;