Giter VIP home page Giter VIP logo

cronus's Introduction

cronus

logo
Schedules custom monitoring jobs and serves a socket.io connected monitoring website.

NPM Version Build Status Codacy Badge Dependency Status devDependency Status NPM Downloads Massachusetts Institute of Technology (MIT) Donate

Demo

demo

Installation

$ npm i -g sa-cronus;

Develop and test monitoring script modules

$ node server/test.js --script jobs/1-minute.js;

Start server

$ sa-cronus [--port 3000] --folder ./jobs [--logFolder d:\logs];

Cron patterns

* * * * * *
┬ ┬ ┬ ┬ ┬ ┬
│ │ │ │ │ |
│ │ │ │ │ └ day of week (0 - 7) (0 or 7 is Sun)
│ │ │ │ └───── month (1 - 12)
│ │ │ └────────── day of month (1 - 31)
│ │ └─────────────── hour (0 - 23)
│ └──────────────────── minute (0 - 59)
└───────────────────────── second (0 - 59, optional)

Detailed description : https://github.com/ncb000gt/node-cron

Example sync monitor job

"use strict";

var Job = function() {
	this.cronPattern = "* * * * * *";
	this.name = "unicorn ONE";
	this.description = "You will see this message every second";
	this.iconCssClassName = "fa fa-database";

	return this;
};


Job.prototype.test = function(/*controller*/) {
	return false;
};

module.exports = Job;

Example async monitor job

"use strict";

var Job = function() {
	this.cronPattern = "*/20 * * * * *";
	this.name = "unicorn timeout";
	this.description = "20-seconds rotating timeout";
	this.iconCssClassName = "fa fa-calendar-times-o";
	this.shouldTimeout = false;
	return this;
};


Job.prototype.testAsync = function(controller, done) {
	var time = 2000;
	if (this.shouldTimeout){
		time = 6000;
	}
	this.shouldTimeout = !this.shouldTimeout;

	setTimeout(function () {
		done(true);
	}, time);
	//return true;
};

module.exports = Job;

More example jobs can be found at /jobs/.

cronus's People

Contributors

s-a avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.