Code Monkey home page Code Monkey logo

ultracron's Introduction

ultracron

Ultracron is a simple job scheduler based on the excellent later module. Ultracron adds some basic job management utilities, syntactic sugar, and monitoring tools.

Example

ultracron.add('test-job', ultracron.schedule.text('every 5 min'), function(done) {
	console.log('I get called every five minutes!');
	done();
});

Later supports all kinds of schedule definitions. (ultracron.schedule == later.parse)

API

add(id, schedule, fn)

Adds a job.

  • id - a unique job id (string)
  • schedule - a later schedule
  • fn - the function to invoke. The job function receives a callback argument, which is used only for statistic reporting. The job function can also return a promise.

addPaused

When true, all jobs are added in the paused state. Useful for development/testing/debugging.

remove(id)

Removes job id.

pause(id)

Pauses job id. Paused jobs will not be invoked on their regular schedule. You can still invoke a paused job manually.

resume(id)

Resumes job id. The job will not be invoked immediately; it will run on its next scheduled occurrence.

reschedule(id, opts)

Modifies the schedule of existing job id.

  • opts.schedule - something parseable by the text parser.

run(id)

Immediately invokes job id.

listen(port)

Ultracron will open port and listen for connections from the monitoring tool. There's absolutely no security, so don't open this port to the world.

Monitoring

Ulracron includes a command-line tool for monitoring the status of your job scheduler.

screenshot

When you npm install -g ultracron, npm adds a ucmon command. The monitor shows you the run/fail count, last run time, and next scheduled run time of each job.

You can also type some commands:

  • pause <jobspec> - pauses job(s)
  • resume <jobspec> - un-pauses job(s)
  • run <jobspec> - immediately invokes job(s)
  • abs - shows last/next run time as absolute time (ie "3/9 12:34p")
  • rel - shows last/next run time as relative time (ie "in 5 minutes")
  • sched <jobspec> <schedule> - changes a job's schedule
  • quit

<jobspec> is a regex that matches one or more job IDs.

ucmon also takes some optional arguments:

  • -h, --host - host to connect to. Default 127.0.0.1.
  • -p, --port - port to connect to. Default 3010.

ultracron's People

Contributors

daguej avatar

Watchers

Adam J. Mendoza 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.