-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fs/issue 147 cron notifications (#150)
* Added cron library. * Created cron to run notifications using cronJob. * Added cron to the server. * Activate a cron to Run everyday at 12:00AM and logging * Forgot that is not semicolon here :p
- Loading branch information
Showing
3 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const CronJob = require('cron').CronJob | ||
|
||
const job = new CronJob({ | ||
// Seconds: 0-59 Minutes: 0-59 Hours: 0-23 Day of Month: 1-31 Months: 0-11 (Jan-Dec) Day of Week: 0-6 (Sun-Sat) | ||
cronTime: '0 0 0 * * *', // everyday at 12:00AM | ||
onTick: () => { | ||
const d = new Date() | ||
// eslint-disable-next-line no-console | ||
console.log('Log to confirm cron job run at', d) | ||
} | ||
}) | ||
|
||
module.exports = { job } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters