script-timer
v3.0.4
Published
Run your scripts at specific intervals, non-stop.
Downloads
6
Readme
Script Timer
Script Timer helps you run cron jobs right inside your application It can help you maintain things like sitemaps, archiving, backups etc.
Installation
Use the npm to install Script Timer.
npm install script-timer
Usage
const {Units, setupAndStart} = require('script-timer');
// setup commit and run intervals
let commitInterval = {unit: Units.HOUR, value: 1};
let runInterval = {unit: Units.DAY, value: 1};
// setup additional config
let config = {
commitInterval: commitInterval,
runInterval: runInterval,
title: "users-archive", //any random name
script: './scripts/archiveUsers.js', //filepath relative to your main project directory
timesRun: 1 //number of times it should run, will run forever if not provided or set to 0
}
// start the timer
setupAndStart(config)
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.