Skip to content

2.9.0 - Generated init script set with incorrect PM2_HOME path #3356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rdamico opened this issue Dec 14, 2017 · 4 comments
Closed

2.9.0 - Generated init script set with incorrect PM2_HOME path #3356

rdamico opened this issue Dec 14, 2017 · 4 comments

Comments

@rdamico
Copy link

rdamico commented Dec 14, 2017

What's going wrong?

On Amazon Linux (AMI) the pm2 startup ... command generates an init script in which the PM2_HOME variable is set incorrectly (the value is set to --hp param without /.pm2 appended).

This is causing PM2 start up (resurection) on system reboot to fail as it does not find the dump.pm2 process file created using pm2 save.

A side affect of this is that all PM2 runtime folders and files ending up in --hp on system init, manually starting PM2 (after sys start up, say pm2 kill & pm2 start cycle) these will he placed in --hp/.pm2

How could we reproduce this issue?

Replace <your_user> and <your_path> as required

  1. Set PM2 to start on system init.
sudo env PATH=$PATH:/usr/local/bin /usr/local/lib/node_modules/pm2/bin/pm2 startup systemv -u <your_user> --hp <your_path>
  1. Open /etc/init.d/pm2-app. You should see the following line:
export PM2_HOME="<your_path>"
  1. Start your application and action the pm2 save command. It will save the dump.pm2 file to <your_path>/.pm2

  2. Reboot system. You should find that PM2 is started but your applcation is not lauched as the init script seems to looking in <your_path> rather than <your_path>/.pm2

Supporting information

PM2 Version: 2.9.0
Node: v6.11.5
NPM: 3.10.10

Let me know if its worthwhile running pm2 report

@Unitech
Copy link
Owner

Unitech commented Dec 14, 2017

Which amazon image exactly? We have not touched to initd.d script at all, we need to try this

@Unitech
Copy link
Owner

Unitech commented Dec 14, 2017

thanks bug reproduced and now fixed, publish will follow

Unitech added a commit that referenced this issue Dec 14, 2017
@Unitech
Copy link
Owner

Unitech commented Dec 14, 2017

published @2.9.1

@Unitech Unitech closed this as completed Dec 14, 2017
@Unitech
Copy link
Owner

Unitech commented Dec 14, 2017

To fix the issue:

$ npm install pm2 -g
$ pm2 update
$ pm2 unstartup
[... line to copy paste ...]
$ pm2 startup
[... line to copy paste ...]

inerc pushed a commit to inerc/pm2 that referenced this issue Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants