Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

co-cron

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

co-cron

Cron tasks for compound apps

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

Co-Cron

  • Basic module to manage CronJobs for your Compound.js Application
  • Based on the excellent npm cron module
  • Check cron out for more documentation on Node.js cron implementation

Usage

npm install co-cron
  • add 'co-cron' to your autoloaders
  • Use the config/initializers/initialize.[js/coffee] to configure Cronjobs on start of an application
  • You can manually create CronJobs or route automation at any time via the methods

Methods

Cron_Wrapper#daemonize_route(namespace, options)

daemonize a specific route on your compound.js app so you can keep your code in the controller and still make it client accessible

compound.cron.daemonize_route 'test',
  route: 'api#test'
  params:
    example: true
  cronTime: '* * * * * *' # every second
  start: false

Cron_Wrapper#job(namespace, options)

task = ->
    # Runs every weekday (Monday through Friday)
    # at 11:30:00 AM. It does not run on Saturday
    # or Sunday.
    console.log "I am a lovely function"

compound.cron.job 'test',
  cronTime: '00 30 11 * * 1-5'    # cron time
  onTick: task                    # function to perform
  start: false                    # to autostart the job or not
  timeZone: "America/Los_Angeles" # schedule it based on a specific timezone 

A convience wrapper for cron's base CronJob creation method

Cron_Wrapper#remove(namespace)

Stops & removes a job stored on a namespace from the Cron_Wrapper.jobs object

Cron_Wrapper#start(namespace)

Starts a job stored on the namespace in the Cron_Wrapper.jobs object

Cron_Wrapper#stop(namespace)

Stops a job stored on the namespace in the Cron_Wrapper.jobs object

  • checkout examples/

Keywords

FAQs

Package last updated on 24 Sep 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc