-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathecosystem.config.js
26 lines (21 loc) · 1.07 KB
/
ecosystem.config.js
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
//IMPORTANT
// In case of maintenance or discontinuation of usage, `pm2 stop all` would termainate all pm2 jobs but they will restart again at the time specified by'cron_restart'parameter. Use `pm2 delete all` to terminate and kill all the processes instead.
const fs = require("fs");
const cron_minute = (int) => int % 2 === 0 ? 0 : 30
const cron_hour = (int) => Math.floor(int / 2)
const apps = [];
fs.readdirSync("./projects/").map((project, index) =>
apps.push({
name: String(project),
script: "./services/fetch-holders/index.js",
args: String(project),
instances: 1,
cron_restart: `${cron_minute(index)} ${cron_hour(index)} * * *`,
// cron_restart: '*/1 * * * *', //this restarts the job every minute and it is intended for testing-purposes and should be turned-off by default
autorestart: false //if set to 'true'(default value for this key) then the job would restart at every successful or errorful exit and causes infinite restart loop, the value for this key-pair must be kept as 'false'.
})
);
console.log(apps);
module.exports = {
apps,
};