domains: validate domain configs in a cron

no email notification yet, we have to rework this notifications/eventlog stuff
This commit is contained in:
Girish Ramakrishnan
2025-02-17 19:01:53 +01:00
parent 3d31f73453
commit 12794a499d
6 changed files with 50 additions and 8 deletions
+10 -1
View File
@@ -29,6 +29,7 @@ const appHealthMonitor = require('./apphealthmonitor.js'),
constants = require('./constants.js'),
{ CronJob } = require('cron'),
debug = require('debug')('box:cron'),
domains = require('./domains.js'),
dyndns = require('./dyndns.js'),
externalLdap = require('./externalldap.js'),
eventlog = require('./eventlog.js'),
@@ -60,7 +61,8 @@ const gJobs = {
schedulerSync: null,
appHealthMonitor: null,
diskUsage: null,
externalLdapSyncer: null
externalLdapSyncer: null,
checkDomainConfigs: null
};
// cron format
@@ -167,6 +169,13 @@ async function startJobs() {
start: true
});
gJobs.checkDomainConfigs = CronJob.from({
cronTime: `00 ${minute} 5 * * *`, // once a day
onTick: async () => await safe(domains.checkConfigs(AuditSource.CRON), { debug }),
start: true
});
gJobs.appHealthMonitor = CronJob.from({
cronTime: '*/10 * * * * *', // every 10 seconds
onTick: async () => await safe(appHealthMonitor.run(10), { debug }), // 10 is the max run time