Cron jobs for Node.js applications that enables developers to execute functions or system commands on schedules defined using standard cron syntax
94
Build a job status monitoring system that tracks and reports the execution state of scheduled jobs.
Create a module that manages scheduled jobs and provides real-time status information about their execution state. The system should:
@generates
Implement the following functions:
createMonitoredJob(name, schedule, callback) - Creates a new scheduled job with the given name, cron schedule, and callback function. Returns a job object.
getJobStatus(name) - Returns an object with status information for the specified job:
name: the job nameisActive: boolean indicating if the job is currently scheduled to runisRunning: boolean indicating if the callback is currently executinggetAllJobStatuses() - Returns an array of status objects for all monitored jobs
startJob(name) - Starts (or resumes) the scheduled execution of the specified job
stopJob(name) - Stops the scheduled execution of the specified job
start option false, isActive should be false and isRunning should be false @teststartJob(), isActive should become true @teststopJob(), isActive should become false @testisRunning should be true, and after completion it should be false @testgetAllJobStatuses() should return status information for all created jobs @test/**
* Creates a new monitored scheduled job
* @param {string} name - Unique name for the job
* @param {string} schedule - Cron expression for scheduling
* @param {Function} callback - Function to execute on schedule
* @returns {Object} Job object
*/
function createMonitoredJob(name, schedule, callback) {}
/**
* Gets the current status of a specific job
* @param {string} name - Name of the job
* @returns {Object} Status object with name, isActive, and isRunning properties
*/
function getJobStatus(name) {}
/**
* Gets status information for all monitored jobs
* @returns {Array<Object>} Array of status objects
*/
function getAllJobStatuses() {}
/**
* Starts a stopped job
* @param {string} name - Name of the job to start
*/
function startJob(name) {}
/**
* Stops a running job
* @param {string} name - Name of the job to stop
*/
function stopJob(name) {}
module.exports = {
createMonitoredJob,
getJobStatus,
getAllJobStatuses,
startJob,
stopJob
};Provides job scheduling and execution state monitoring capabilities.
Install with Tessl CLI
npx tessl i tessl/npm-cronevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10