JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 39
  • Score
    100M100P100Q92043F

Package Exports

  • cronbee

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cronbee) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Cronbee


Build Status NPM version

Manage, run and log all your scheduled tasks using system capabilities with crontab and schtasks

Scheduler

Create scheduled task

If the task already exists, does nothing

import { cronbee } from 'cronbee'

await cronbee.ensure({
    // Name your task
    taskName: 'check emails',
    // Execute any Shell command with arguments
    taskRun: `node emailchecker --foo`,

    // By default the working directory will be the current directory
    workingDirectory: '/home/www'

    /** Depending on the system, define timing configurations for crontab or schtasks separately */

    // crontab example
    cron: '0 12 * * *',

    // schtasks example
    schtaskFlags: '/sc daily /st 12:00',
})
List scheduled tasks
let tasks = await cronbee.load();
Remove scheduled task
await cronbee.remove({ taskName: 'check emails' });

Runner

Though you can define any shell command to be executed at scheduled time, you can also use the cronbee as a wrapped runner, to log executions to CSV files. Just prefix your command with cronbee and you are done.

await cronbee.ensure({
    // ... config
    taskRun: `cronbee node emailchecker --foo`,
});