scheduled-tasks
NOTE: Although, this package works, I recommend using percolatestudio:synced-cron instead because it supports multiple app instances.
A Meteor package that provides a simple API for scheduling a function to run on the server. This is a fairly basic wrapper around laterjs and also exports the later
variable.
Requires Meteor 0.9.0+
Installing
In a Meteor app directory:
$ meteor add aldeed:scheduled-tasks
Using
In server code, assuming sendHourlyEmails
is a function defined elsewhere:
1var schedule = later.parse.recur().on(5).minute(); // on fifth minute of every hour, every day 2var hourlyEmailer = new ScheduledTask(schedule, sendHourlyEmails); 3 4Meteor.startup(function () { 5 hourlyEmailer.start(); 6});
You can alternatively provide a string to be text-parsed by laterjs:
1var task = new ScheduledTask('at 10:15 am also at 5:15pm except on Tuesday', function () { 2 console.log("Scheduled task was run."); 3}); 4task.start();
Contributing
Anyone is welcome to contribute. Fork, make your changes, and then submit a pull request.