Schedules custom monitoring jobs and serves a socket.io connected monitoring website.
$ npm i -g sa-cronus;
$ sa-cronus [--port 3000] --folder ./jobs [--logFolder d:\logs];
$ npm i sa-cronus;
#!/usr/bin/env node
const minimist = require('minimist')
const CronusServer = require('sa-cronus')
const argv = minimist(process.argv.slice(2))
const port = argv.port || 3000
const cronusServer = new CronusServer({
port,
folders: [argv.folder],
bunyanLogSettings: {
name: 'cronus',
streams: [
{
level: 'trace',
stream: process.stdout
}
]
}
})
const run = async () => {
await cronusServer.start()
}
run()
* * * * * *
┬ ┬ ┬ ┬ ┬ ┬
│ │ │ │ │ |
│ │ │ │ │ └ day of week (0 - 7) (0 or 7 is Sun)
│ │ │ │ └───── month (1 - 12)
│ │ │ └────────── day of month (1 - 31)
│ │ └─────────────── hour (0 - 23)
│ └──────────────────── minute (0 - 59)
└───────────────────────── second (0 - 59, optional)
Detailed description : https://github.com/ncb000gt/node-cron
- Migrate to Twitter Bootstrap 5
job.testAsync
is obsolete useasync job.verify
insteadjob.shouldTimeout
bool
is obsolete usejob.timeout
int
insteadjob.timout
is now optional but recommended
var Job = function () {
this.cronPattern = "*/2 * * * * *";
this.name = "async";
this.iconCssClassName = "fa fa-calendar-times-o";
this.timeout = 100000
this.description = "You will see this message every 2 seconds";
return this;
};
Job.prototype.verify = async function (controller) {
controller.log.warn("invoke async test function")
return true;
};
module.exports = Job;
More example jobs can be found at /jobs/.