JSPM

  • Created
  • Published
  • Downloads 3263719
  • Score
    100M100P100Q224690F

CronJob's for your node

Package Exports

  • cron

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cron) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

A NodeJS fork of jamespadolsey's cron.js.

Usage:

var cron = require('cron'), sys = require('sys');
new cron.CronJob('* * * * * *', function(){
    sys.puts('You will see this message every second');
});

Available Cron patterns:

Asterisk. E.g. *
Ranges. E.g. 1-3,5
Steps. E.g. */2

Read up on cron patterns here.

Another example

var cron = require('cron'), sys = require('sys');
new CronJob('00 30 11 * * 2-6', function(){
    // Runs every weekday (Monday through Friday)
    // at 11:30:00 AM. It does not run on Saturday
    // or Sunday.
});

How to check if a cron pattern is valid:

    try {
        new cron.CronTime('invalid cron pattern', function() {
            sys.puts('this should not be printed');
        })
    } catch(ex) {
        sys.puts("cron pattern not valid");
    }

Install

From source: `sudo npm install`
From npm: `sudo npm install cron`

Contributors

  • Nick Campbell
  • Finn Herpich
  • James Padolsey
  • cliftonc
  • Finn
  • neyric
  • humanchimp

License

This is under a dual license, MIT and GPL. However, the author of cron.js hasn't specified which version of the GPL, once I know I'll update this project and the packaging files.

Trademarks?

Node.js™ is an official trademark of Joyent. This module is not formally related to or endorsed by the official Joyent Node.js open source or commercial project