const moment = require('moment') module.exports = async function (app, opts) { const jobs = {} try { const { models } = app.fs.dc const tasks = await models.AcquisitionTask.findAll({ where: { enabled: true } }) tasks.map(s => { const job = app.fs.scheduleInit( { interval: s.cron, immediate: true, proRun: false, }, async () => { try { console.log(s.taskName, moment().format('YYYY-MM-DD HH:mm:ss')); } catch (error) { app.fs.logger.error(`sechedule: taskJobs, error: ${error}`) } }); jobs[s.id] = job; }) } catch (error) { app.fs.logger.error(`sechedule: acqTask, error: ${error}`); } return { taskJobs: jobs } }