How to use the node-schedule.scheduledJobs function in node-schedule

To help you get started, we’ve selected a few node-schedule examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github funsocietyirc / MrNodeBot / lib / scheduler.js View on Github external
logger.info(t('libraries:scheduler.systemTask', {
            name,
        }));
        systemJobs.push(name);
    }

    // Pass the new job to the scheduler
    scheduler.scheduleJob(name, time, callback);
};

// Export functions
module.exports = {
    schedule,
    clear,
    RecurrenceRule: scheduler.RecurrenceRule,
    jobs: scheduler.scheduledJobs,
    Range: scheduler.Range,
};
github funsocietyirc / MrNodeBot / lib / scheduler.js View on Github external
const schedule = (name, time, callback, system) => {
    // Job already exists
    if (_.includes(scheduler.scheduledJobs, name)) {
        logger.warn(t('libraries:scheduler.duplicate', {
            name,
            time,
        }));
        return;
    }
    // Callback is missing
    if (!_.isFunction(callback)) {
        logger.warn(t('libraries:scheduler.missingCallback', {
            name,
        }));
        return;
    }

    // If this is a system job, keep track so we do not purge during reload
    if (system === true) {
github klren0312 / stm32_wifi / Nodejs_Server / autofood.js View on Github external
conn.query('select * from autofood', function(err,rows,fields){
				let len = rows.length;
				let tem = rows[len-1].type;
				if (tem !== x) {
					if (schedule.scheduledJobs['feed']) {
						var result = schedule.cancelJob('feed');
						console.log("关闭当前定时: ")
						console.log(result)
					}
					big()
				}else{
					console.log("same")
				}
			})
}
github klren0312 / stm32_wifi / Nodejs_Server / autofood.js View on Github external
conn.query('select * from autofood',function(err,rows,fields){
		var i = rows.length;
		var tem = rows[i-1].type;
		console.log(tem);
		change(tem)
		console.log(schedule.scheduledJobs)
		setInterval(function(){
			check(tem)
		},3000)
	})
}
github viz-centric / flair-notifications / app / shedular.js View on Github external
reShedulJob: function (jobName, start_date, end_date, cron_exp) {
        let cron_expression = {
            start: moment(start_date).toDate(),
            end: moment(end_date).toDate(),
            rule: cron_exp
        };
        all_jobs = scheduler.scheduledJobs;
        result = all_jobs[jobName].reschedule(cron_expression);
        return result;
    }
}
github funsocietyirc / MrNodeBot / lib / scheduler.js View on Github external
const clear = () => _.forEach(scheduler.scheduledJobs, (job) => {
    if (!_.includes(systemJobs, job.name)) {
        job.cancel();
    }
});
github viz-centric / flair-notifications / app / shedular.js View on Github external
cancleJob: function (jobName) {
        all_jobs = scheduler.scheduledJobs
        if (jobName in all_jobs) {
            all_jobs[jobName].cancel()
            return true
        }
        else {
            return false;
        }


    },
    reShedulJob: function (jobName, start_date, end_date, cron_exp) {

node-schedule

A cron-like and not-cron-like job scheduler for Node.

MIT
Latest version published 2 years ago

Package Health Score

82 / 100
Full package analysis