-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
33 lines (30 loc) · 786 Bytes
/
app.js
File metadata and controls
33 lines (30 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const { execFile } = require('child_process'),
CronJob = require('cron').CronJob,
slack = require('./actions/slack'),
config = require('./config');
let http = execFile('node', [`${__dirname}/services/http.js`], {
detached: true,
stdio: 'ignore'
});
const monthlyRolloverJob = new CronJob(
'00 00 01 01 */1 *',
function() {
slack({ channel: config.slack.channel }, 'Monthly rollover is rolling!');
execFile('node', [`${__dirname}/services/monthly.js`], {
detached: true,
stdio: 'ignore'
});
},
function() {
/* This function is executed when the job stops */
slack(
{ channel: config.slack.channel },
'Monthly rollover cron job has stopped'
);
},
true /* Start the job right now */
);
process.on('SIGINT', () => {
http.kill();
process.exit(0);
});