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

seneca-cron

v0.0.5

Published

Cron plugin for Seneca framework

Downloads

10

Readme

Seneca

A Seneca.js cron storage plugin

seneca-cron

npm version Build Status Coverage Status

Cron plugin for Seneca framework.

For a gentle introduction to Seneca itself, see the senecajs.org site.

If you're using this plugin module, feel free to contact me on twitter if you have any questions! :) @Alexandru_M

Install

To install, simply use npm. Remember you will need to install Seneca.js separately.

npm install seneca
npm install seneca-mysql-store

Test

To run tests, simply use npm:

npm run test

Quick Example

var seneca = require('seneca')()
seneca.use('cron')
var jobid

function someAction() {
    si.log.debug('tick-tick');
}

si.act({ role: 'cron', cmd: 'addjob', time: '* * * * * *', act: someAction(), after: null, timezone: null }, function (err, res) {
  jobid = res.id
})

Actions

Add cron job

  • role:name, cmd:'addjob'
  • parameters:
    • time - Cron pattern - see bellow
    • act - Function to be executed on cron
    • after - Function to be executed when the job stops
    • timezone - Specify the timezone for the execution. This will modify the actual time relative to your timezone
  • callback with usual node error-first callback structure - (err, response) where response is JSON:
    • id: job id
    • status: 'added'

Start a cron job

  • role:name, cmd:'startjob'
  • parameters:
    • id - id of job to be started
  • callback with usual node error-first callback structure - (err, response) where response is JSON:
    • id: job id
    • status: 'started'

Stop a cron job

  • role:name, cmd:'stopjob'
  • parameters:
    • id - id of job to be stopped
  • callback with usual node error-first callback structure - (err, response) where response is JSON:
    • id: job id
    • status: 'stopped'

Close a cron job - it will remove completely the specified job

  • role:name, cmd:'closejob'
  • parameters:
    • id - id of job to be closed
  • callback with usual node error-first callback structure - (err, response) where response is JSON:
    • id: job id
    • status: 'closed'

Close all cron jobs - it will remove completely all jobs

  • role:name, cmd:'close'
  • callback with usual node error-first callback structure - (err, response)

Cron patterns

Here are presented information regarding the cron job patterns.

Cron Ranges

When specifying your cron values you'll need to make sure that your values fall within the ranges.

Supported ranges specifiers:

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

Supported ranges types:

  • Seconds: 0-59
  • Minutes: 0-59
  • Hours: 0-23
  • Day of Month: 1-31
  • Months: 0-11
  • Day of Week: 0-6

Contributing

The Senecajs org encourage open participation. If you feel you can help in any way, be it with documentation, examples, extra testing, or new features please get in touch.