pm2
pm2 copied to clipboard
cron_restart value is always inherited when I try to start another app in the same namespace programatically
I have a pm2 process which is the 'root' that manages several other processes. It spawns the other processes under pm2
module.exports = {
apps: [
{
name: `${appspace}.root`,
namespace: appspace,
script: "index.js",
args: [],
cron_restart: "0 5 * * Sun",
exec_mode: 'fork',
kill_timeout: 5000,
},
],
};
index.js:
let p = {
"wait_ready": true,
"namespace": this.appspace,
"name": `${this.appspace}.${m}`,
"script": run_path,
"args": args,
"node_args": node_args,
"windowsHide": true,
"max_restarts": 5,
"autorestart": true,
"restart_delay": 5000,
"cron_restart" : "0" // trying to prevent inheriting
};
pm2.start(p);
No matter what I try, the other processes always inherits root's cron_restart value. The root process handles all exit signals and closes the pm2 processes in the same appspace. Although it does no harm to close the other processes at the same time as the root, it's just not desirable. Seems like a bug. How do I prevent pm2 assigning the same cron_restart value as root?
bump
This is still an issue and causing problems on my end.
same here