How to use the scheduleJob function from node-schedule
Find comprehensive JavaScript node-schedule.scheduleJob code examples handpicked from public code repositorys.
GitHub: simatec/ioBroker.backitup
518 519 520 521 522 523 524 525 526 527
if (backupTimeSchedules[type]) { backupTimeSchedules[type].cancel(); } const cron = `10 ${time[1]} ${time[0]} */${config.everyXDays} * * `; backupTimeSchedules[type] = schedule.scheduleJob(cron, async () => { const sysCheck = await systemCheck.storageSizeCheck(adapter, adapterName, adapter.log); if ((sysCheck && sysCheck.ready && sysCheck.ready === true) || adapter.config.cifsEnabled === true) { adapter.setState('oneClick.' + type, true, true);
31
52
9
+ 9 other calls in file
657 658 659 660 661 662 663 664 665 666 667 668 669
} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ++++++++++++++++++ reset current Action in the night at 02:30 +++++++++++++++++++++++ const calc = schedule.scheduleJob('calcTimer', '30 2 * * *', async function () { shutterDriveCalc(); const resultStates = shutterSettings; if (resultStates) {
26
38
7
+ 9 other calls in file
109 110 111 112 113 114 115 116 117 118 119
exports.disableAllScheduled = () => { jobscheduler.gracefulShutdown(); } exports.scheduleServerRestart = (crontab_text, server) => { jobscheduler.scheduleJob(crontab_text, function () { if (serverjson_cfg[server]['status'] == 'started') { restart_after_stop[server] = true; command = Buffer.from("stop", 'utf-8').toString(); servers_logs[server] = servers_logs[server] + command + "\n";
11
20
3
+ 4 other calls in file
GitHub: zixuan97/algotech-be
3 4 5 6 7 8 9 10 11 12 13
const scheduledNewsletterModel = require('../models/scheduledNewsletterModel'); const { log } = require('./logger'); const scheduleJobs = async (req) => { const { customerEmails, newsletter, sentDate, jobId } = req; const job = schedule.scheduleJob(jobId, sentDate, async () => { await Promise.all( customerEmails.map(async (email) => { await emailHelper.sendEmail({ recipientEmail: email,
7
2
0
+ 2 other calls in file
25 26 27 28 29 30 31 32 33
return v } schedule() { this.scheduleJob = schedule.scheduleJob({ rule: scheduleConfig.getRule() }, () => { this.startRandomPuzzle() // reschedule for tomorrow
4
6
0
+ 2 other calls in file
83 84 85 86 87 88 89 90 91 92
} else if (myJob.date && myJob.date != "*" && myJob.month && myJob.month != "*") { stopTime = `${myJob.mins} ${myJob.timeToStop} ${myJob.date} ${myJob.month} *`; } else { stopTime = `${myJob.mins} ${myJob.timeToStop} * * *`; } await schedule.scheduleJob(myJob.groupName + '_stop', stopTime, async function () { var processorsList = await axios.get(`${process.env.NIFI_URL}/process-groups/root/process-groups`); let groupId1; processorsList.data.processGroups.map(process => {
20
1
0
656 657 658 659 660 661 662 663 664 665
_startCronJob() { if (!this._cronJob) { this.logger.info('starting bucket queueing cron job', { cronRule: this._cronRule }); this._cronJob = schedule.scheduleJob( this._cronRule, () => this.processBuckets(null)); } }
18
51
60
+ 7 other calls in file
648 649 650 651 652 653 654 655 656 657
}); // if an error occurs, need to retry // for now, schedule minute from now const date = new Date(); date.setMinutes(date.getMinutes() + 1); this.scheduleResume = schedule.scheduleJob(date, triggerResume.bind(this)); } else { if (this.scheduledResume) { this.scheduledResume.cancel();
18
51
60
+ 9 other calls in file
GitHub: scality/backbeat
280 281 282 283 284 285 286 287 288 289
loadProcessors(zkClient); async.series([ done => ingestionPopulator.open(done), done => { scheduler = schedule.scheduleJob(ingestionExtConfigs.cronRule, () => queueBatch(ingestionPopulator, log)); return done(); }, done => startProbeServer(ingestionExtConfigs.probeServer, (err, probeServer) => {
18
51
60
+ 3 other calls in file
GitHub: DTStack/doraemon
11 12 13 14 15 16 17 18 19 20 21
// 开始文章订阅任务 const createTimedTask = (name, cron, agent) => { if (timedTaskIsExist(name, agent)) return log(agent, `创建文章订阅任务, id: ${ name }, Cron: ${ cron }`) schedule.scheduleJob(`${ name }`, cron, () => { // agent 进程随机给一个 app 进程发消息(由 master 来控制发送给谁) agent.messenger.sendRandom('sendArticleSubscription', name) }) }
5
25
0
GitHub: Thomah/boothby
0 1 2 3 4 5 6 7 8 9 10 11 12
const schedule = require("node-schedule"); var jobs = []; exports.schedule = function (config, callback) { jobs[config.name] = schedule.scheduleJob(config.cron, callback); }; exports.reschedule = function (config) { jobs[config.name] = schedule.rescheduleJob(jobs[config.name], config.cron);
2
0
0
+ 3 other calls in file
8 9 10 11 12 13 14 15 16
const date = new Date(user.date); const jobId = await genId.value(8); logger.debug("JOB ID IS ...." + jobId); schedule.scheduleJob(jobId, date, async () => { logger.debug("scheduler is running at " + user.date); await sendEmail(email, user.description, "This is Email Reminder"); await updateDbStatus(email, jobId);
1
1
0
707 708 709 710 711 712 713 714 715
} } // create schedule Jobs for online and historic values createScheduleJobs(){ this.cronJobs[this.cronJobIds.getAdditionalDeviceInformations] = schedule.scheduleJob(this.cronJobValues.getAdditionalDeviceInformations,this.getAdditionalDeviceInformations.bind(this)); this.cronJobs[this.cronJobIds.refreshOnlineCronJob] = schedule.scheduleJob(this.config.refreshOnlineCronJob,this.readOnlineValues.bind(this)); this.cronJobs[this.cronJobIds.refreshHistoricCronJob] = schedule.scheduleJob(this.config.refreshHistoricCronJob,this.readHistoricValues.bind(this)); }
1
0
0
+ 29 other calls in file
53 54 55 56 57 58 59 60 61
} } } } this.Event = new events.EventEmitter(); this.schedule = schedule.scheduleJob('28 * * * * *', function () { this.TriggerUpdate(); }.bind(this)); }
0
5
2
+ 4 other calls in file
160 161 162 163 164 165 166 167 168 169 170
module.exports.splatoon3InkScheduler = () => { let splatoon3Ink = new Splatoon3Ink() log.write('start fetch', splatoon3Ink.apiBase, 'every 2 hours') schedule.scheduleJob('1 */2 * * *', () => { splatoon3Ink.buildRotations() }) }
0
6
1
+ 8 other calls in file
59 60 61 62 63 64 65 66 67 68 69 70 71
// }); // } // } // schedule.scheduleJob('* 12 * * 1', function() { // sendGroupText(newsletterNumbers, 0); // }); const toneParams = {
0
2
1
127 128 129 130 131 132 133 134 135
const schedule = `${rndMinutes} ${rndHours} * * *`; //const schedule = `10 * * * * *`; this.log.info(`Schedule daily values. ${schedule}`); this.schedule = mSchedule.scheduleJob(schedule, async () => { const dayDeviceUsage = await this.emVue.getEmpDayUsage(); //this.log.info(JSON.stringify(dayDeviceUsage)); this.log.info(`instant:${dayDeviceUsage.instant} scale:${dayDeviceUsage.scale} unit:${dayDeviceUsage.energyUnit}`);
0
2
1
+ 4 other calls in file
GitHub: faricaav/FinalTest_Dans
8 9 10 11 12 13 14 15 16 17 18
const xlsx = require('xlsx') const path = require("path") const fs = require("fs") // Schedule the function to run at midnight every day const job = scheduler.scheduleJob('0 0 * * *', async () => { try { const lemburs = await lembur.findAll({ where: { status: 'pending',
0
0
1
+ 4 other calls in file
GitHub: godicheol/mongodb-backup
72 73 74 75 76 77 78 79 80 81
// │ │ │ └────────── day of month (1 - 31) // │ │ └─────────────── hour (0 - 23) // │ └──────────────────── minute (0 - 59) // └───────────────────────── second (0 - 59, OPTIONAL) const setSchedule = function(cron, options, cb) { return schedule.scheduleJob(cron, async function() { try { await backup(options); cb(null, true); } catch(err) {
0
0
1
+ 4 other calls in file
218 219 220 221 222 223 224 225 226 227
// Cancela a schedule anterior da sessão const job = schedule.scheduledJobs[`${sessao}`]; schedule.cancelJob(job); // Inicia a schedule schedule.scheduleJob(`${sessao}`, expire, async () => { await lltckt_cart.findAll({ where: { session_id: sessao }, include: { model: lltckt_product,
0
0
0
node-schedule.scheduledJobs is the most popular function in node-schedule (381 examples)