script-timer

3.0.4 • Public • Published

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.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i script-timer

Weekly Downloads

1

Version

3.0.4

License

ISC

Unpacked Size

16.3 kB

Total Files

5

Last publish

Collaborators

  • khurramasad299