Skip to content

raphaelivan/cronzitto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cronzitto

Cronzitto allows you to schedule tasks to run.

NPM

Install

First of all, make sure you have Node.js installed.

  $ [sudo] npm install cronzitto

Usage

Require cronzitto module

var Cron = require('cronzitto');

Watch an event

  var watchMail = Cron.watch( function() {
    //Mail.getAll();
  }, '10 minutes');

The watch method accepts two parameters: the callback and timer.

Cancel an event

To cancel a cronzitto event, use the cancel method

  watchMail.cancel();

Reset an event time

Reset the execution time.

  watchMail.resetTimer('30 minutes');

Sleep

Wait a while to continue execution

  watchMail.sleep('5 minutes');

Execute only once

Perform a task only once, after the end of the timer.

  Cron.once( function() {
    //run after a minute
  }, '1 minute');

Notify

You can receive notifications when the task finishes or is stopped.

Requirements! To use Growl notifications, you need to install node-growl.

Non-Notify

To disable the notifications engine, set the Cronzitto:

  Cron.config.notify = false;

Non-Beep

To disable the BEEP sound:

  Cron.config.beep = false;

License

Cronzitto is available under the MIT license.