Unitech / Unitech/pm2

PM2 watch will always restart all when 1 file changed

Open
#5,556 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

I have 4 processes but i want when edit 1 file only restart that file, not all file. right now the issues all file got restarted
image

How could we reproduce this issue?

Supporting information

pm2 -f start xxx.js --name xxx--watch --max-restarts 1 --restart-delay 3000
this is the code when I first run.

  apps: [
    {
      name: '8gifxnl0',
      script: '8gifxnl0.js',
      watch: '8gifxnl0.js',
      ignore_watch: ['node_modules', 'logs', 'public']
    },
    {
      name: 'azvlkrc5',
      script: 'azvlkrc5.js',
      watch: 'azvlkrc5.js',
      ignore_watch: ['node_modules', 'logs', 'public']
    },
    {
      name: 'jheqc8xx',
      script: 'jheqc8xx.js',
      watch: 'jheqc8xx.js',
      ignore_watch: ['node_modules', 'logs', 'public']
    },
    {
      name: '750omuja',
      script: '750omuja.js',
      watch: '750omuja.js',
      ignore_watch: ['node_modules', 'logs', 'public']
    },
    {
      name: 'service-worker',
      script: './service-worker/',
      watch: ['./service-worker']
    }
  ],
  deploy: {
    // Add deployment configuration as needed
  }
};

this is the code for ecosystem.config.js

$ pm2 report

I cannot copy paste cause i use RDP in terminal it cant copy
image
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the watch behavior with the provided ecosystem.config.js and the five configured scripts, then inspect the PM2 watch/restart entry point. Confirm whether changing one watched file restarts every process; done means only the process associated with the changed file restarts, while unrelated processes continue running.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.