Chronos is a simple tool that let's you control and handle simple javascript cronjobs for your project.
Yarn:
yarn add https://github.com/argus-inc/chronos
NPM:
npm install @argus-inc/chronos
Create a file with your cron configuration.
For each cron you will have to specify: path, recurrence, command, name
path: Specify an absolute path to the file you want to run as cron.
recurrence: The crontab recurrence string
command: The command the cron will be executed with eg: node
name: Name of the cron
[
{
"path": "/Users/xxx/programs/myProgram/cron/index.js",
"recurrence": "*/5 * * * *",
"command": "node",
"name": "getEvents"
},
{
"path": "/Users/xxx/programs/myProgram/cron/apiCall.js",
"recurrence": "*/5 * * * *",
"command": "node",
"name": "getUsers"
}
]
You can then add this command as a script to your package.json
.
"scripts": {
"cron": "yarn run chronos --config=src/config/chronos.json",
},
Author: Argus
Developer: Mederic Burlet
Licence: GPL-3-0-only