How to use node-schedule.default:
30 31 32 33 34 35 36 37 38 39
}; const createJob = (wl, cb) => __awaiter(void 0, void 0, void 0, function* () { const { itemID, itemName, nextOn, server } = wl; const nextJobDate = (0, fromUnixTime_1.default)(nextOn); cancelJob(itemID, server); const newJob = node_schedule_1.default.scheduleJob(nextJobDate, function () { return __awaiter(this, void 0, void 0, function* () { const date = new Date(); console.log(`\n${server} [${itemID}:${itemName}] Running... ${date}`); return yield cb(wl);
How to use node-schedule.rescheduleJob:
GitHub: DTStack/doraemon
20 21 22 23 24 25 26 27 28 29 30 31
} // 改变文章订阅任务的时间规则 const changeTimedTask = (name, cron, agent) => { if (!timedTaskIsExist(name, agent)) return createTimedTask(name, cron, agent) schedule.rescheduleJob(schedule.scheduledJobs[`${ name }`], cron) log(agent, `编辑文章订阅任务, id: ${ name }, Cron: ${ cron }`) } // 取消指定文章订阅任务
How to use node-schedule.RecurrenceRule:
GitHub: rovelstars/discord-list
4 5 6 7 8 9 10 11 12 13 14
const schedule = require("node-schedule"); let router = require("express").Router(); router.use(require("express").json()); globalThis.coronaSanitizer = require("sanitize-html"); const rule = new schedule.RecurrenceRule(); rule.dayOfWeek = 0; rule.hour = 12; rule.minute = 0; schedule.scheduleJob(rule, async function () {
52
181
4
See more examples
How to use node-schedule.gracefulShutdown:
125 126 127 128 129 130 131 132 133 134 135
} }); } exports.rescheduleAllServers = () => { jobscheduler.gracefulShutdown() .then(function () { jobscount = 0; for (const [key, value] of Object.entries(serverjson_cfg)) { if (typeof serverjson_cfg[key]['restartScheduler'] !== "undefined" && serverjson_cfg[key]['restartScheduler']['enabled'] == 'true') {
11
21
3
See more examples
How to use node-schedule.cancelJob:
74 75 76 77 78 79 80 81 82 83
schedule.cancelJob('shutterUpGoldenHourEnd'); schedule.cancelJob('calcTimer'); schedule.cancelJob('shutterDownGoldenHour'); schedule.cancelJob('shutterUpSunrise'); schedule.cancelJob('shutterDownSunset'); schedule.cancelJob('shutterUpLiving'); schedule.cancelJob('shutterDownLiving'); schedule.cancelJob('shutterUpSleep'); schedule.cancelJob('shutterDownLate'); schedule.cancelJob('shutterDownComplete');
26
38
7
See more examples
How to use node-schedule.scheduleJob:
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
See more examples
How to use node-schedule.scheduledJobs:
GitHub: zixuan97/algotech-be
51 52 53 54 55 56 57 58 59 60 61 62
} return 'Job updated'; }; const getScheduledNewsLetters = async (req) => { jobs = schedule.scheduledJobs; return jobs; }; exports.scheduleJobs = scheduleJobs;