node-task-scheduler

2.2.0 • Public • Published

node-task-scheduler Build Status npm version Coverage Status

A Task scheduler for node.js, with cron-syntax, specific execution intervals and due dates.

Instalation

npm install --save node-task-scheduler

Example usage

var nts=require('node-task-scheduler');
 
var scheduler = nts.init({
  // add some parameters! Check wiki for details
});
 
global.scheduler = scheduler; //available to entire application
 
//starting previous tasks
ts.start(function(taskNames){
  console.log("Previous tasks loaded:");
  taskNames.forEach(function(taskName){
    console.log(taskName);
  });
});
 
...
 
//adding task, to be executed each minute, until endDate
scheduler.addTask('hello', {hello: 'world'}, function(args, callback){
  console.log("Hello from hello! ", "ARGS: "+args.hello);
  callback();
}, "0 * * * * *", endDate);
 
...
 
//removing the task
scheduler.removeTask('hello', function(){
  console.log("Task 'hello' removed.");
});

Wiki

Yes, we have a wiki! Click here for details.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i node-task-scheduler

Weekly Downloads

1

Version

2.2.0

License

MIT

Last publish

Collaborators

  • giovanebribeiro