npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ultracron

v0.0.7

Published

A job scheduler that uses later

Downloads

175

Readme

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.