Skip to content

cron_restart value is always inherited when I try to start another app in the same namespace programatically #6016

@twilson90

Description

@twilson90

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions