Unitech / Unitech/pm2

script such as script: 'bash -c "source $HOME/.bashrc && node app.js"' fail to run in cluster mode

Open
#5,735 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 need to source my bashrc before running the app.js.
I tried this script in the ecosystem:
script: 'bash -c "source $HOME/.bashrc && node app.js"',
This works fine in 'fork' mode, but keeps restarting in 'cluster' mode.
Is that expected. Any suggested workarounds?

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 ecosystem configuration with bash -c, source $HOME/.bashrc, and node app.js in both fork and cluster modes. Compare the process behavior and determine whether the cluster-mode restart is expected; done means documenting a confirmed workaround or identifying the behavior that needs correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, javascript, node.js
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.