A Seneca.js cron plugin
seneca-node-cron
node-cron plugin for Seneca framework.
For a gentle introduction to Seneca itself, see the senecajs.org site.
Install
To install, simply use npm. Remember you will need to install Seneca.js separately.
npm install seneca
npm install seneca-node-cron
Test
To run tests, simply use npm:
npm run test
Examples
Click here to access the examples
Actions
Create cron job
Create a new cron job
Parameters | Type | Default | Required | Description |
---|---|---|---|---|
cronTime | String, Date | true |
CronTime accepted by node-cron | |
tickAction | String, Object, Function | true |
Action to be executed on each tick of the job | |
onJobStop | String, Object, Function | null |
Action to be executed when the job is stopped | |
start | Boolean | false |
If true automatically starts the job | |
timezone | String | '' |
Please refer to this for the supported timezones | |
runOnInit | Boolean | false |
If true fire the tickAction immediately after job creation |
Examples
seneca;
seneca;
Start cron job
Start a job matching by id
Parameters | Type | Default | Required | Description |
---|---|---|---|---|
id | UUID | true |
Id of job |
Examples
seneca;
Stop cron job
Stops a job matching by id
Parameters | Type | Default | Required | Description |
---|---|---|---|---|
id | UUID | true |
Id of job |
Examples
seneca;
Remove cron job
Safelly remove a job matching by id, trying to stop it before remove
Parameters | Type | Default | Required | Description |
---|---|---|---|---|
id | UUID | true |
Id of job |
Examples
seneca;
Remove all cron jobs
Safelly remove all jobs, trying to stop then before remove
Examples
seneca;
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.