Daily actions fix, typo fix, incremented maxPWCount

This commit is contained in:
MrFry 2020-04-13 09:20:36 +02:00
parent 3aa36520d4
commit f3e6f21ad5
2 changed files with 22 additions and 8 deletions

View file

@ -17,7 +17,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
------------------------------------------------------------------------- */
console.clear()
process.stdout.write('\u001b[2J\u001b[0;0H') // console.clear()
const startHTTPS = true
const isRoot = process.getuid && process.getuid() === 0
@ -125,7 +125,7 @@ Object.keys(modules).forEach(function (k, i) {
const modApp = mod.getApp()
x.app = modApp.app
x.dailyAction = modApp.DailyAction
x.dailyAction = modApp.dailyAction
x.cleanup = modApp.cleanup
x.urls.forEach((url) => {
@ -169,10 +169,20 @@ function setLogTimer () {
const night = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate() + 1, // the next day, ...
0, 0, 0 // ...at 00:00:00 hours
now.getDate() + 1,
0,
0,
0
)
logger.DebugLog(`Next daily action: ${night}`, 'daily', 1)
const msToMidnight = night.getTime() - now.getTime()
logger.DebugLog(`msToMidnight: ${msToMidnight}`, 'daily', 1)
logger.DebugLog(`Seconds To Midnight: ${msToMidnight / 1000}`, 'daily', 1)
if (msToMidnight < 0) {
logger.Log(`Error setting up Log Timer, msToMidnight is negative! (${msToMidnight})`, logger.GetColor('redbg'))
return
}
setTimeout(function () {
LogTimerAction()
@ -181,10 +191,13 @@ function setLogTimer () {
}
function LogTimerAction () {
logger.DebugLog(`Running Log Timer Action`, 'daily', 1)
Object.keys(modules).forEach((k, i) => {
const x = modules[k]
logger.DebugLog(`Ckecking ${k}`, 'daily', 1)
if (x.dailyAction) {
try {
logger.Log(`Running daily action of ${k}`)
x.dailyAction()
} catch (e) {
logger.Log(`Error in ${k} daily action! Details in STDERR`, logger.GetColor('redbg'))