Skip to content
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

pm2 startup cannot generate startup scripts for multiple users #889

Closed
dantman opened this issue Dec 19, 2014 · 10 comments
Closed

pm2 startup cannot generate startup scripts for multiple users #889

dantman opened this issue Dec 19, 2014 · 10 comments

Comments

@dantman
Copy link

dantman commented Dec 19, 2014

When using pm2 startup (at least when using pm2 startup ubuntu -u x) the same init.d file is used every time.

This means that because --run-as-user has been removed you can no longer easily have scripts started by pm2 that run under different users, they all have to run as the same user.

@soyuka
Copy link
Collaborator

soyuka commented Dec 19, 2014

Or you install one pm2 instance per user that'd run his own apps, and the problem is fixed.

@dantman
Copy link
Author

dantman commented Dec 19, 2014

Or you install one pm2 instance per user that'd run his own apps, and the problem is fixed.

What do you mean by instance?

@soyuka
Copy link
Collaborator

soyuka commented Dec 19, 2014

Each unix user has it's own npm and it's own pm2 binary :).

@dantman
Copy link
Author

dantman commented Dec 19, 2014

Each unix user has it's own npm and it's own pm2 binary :).

Even if I wanted to install pm2 per-user that would't make any difference. Each pm2 instance would still try to use the same location for its startup script (/etc/init.d/pm2-init.sh in this case).

@soyuka
Copy link
Collaborator

soyuka commented Dec 19, 2014

Indeed that should be fixed. For the time being , you could easily build your own startup script that calls every pm2 user.

@dantman
Copy link
Author

dantman commented Dec 19, 2014

Aye, at the moment I'm looking into making my puppet manifest copy the file and use sed to change the USER= in the file.

@ashconnell
Copy link

+1

@PierreGambarotto
Copy link

With the PR #1202, pm2 startup -u username … adds the username to the init script name.
Hope this helps.

@DeveloperAlex
Copy link

I had the same problem on ubuntu 14.04. Fixed it by running "sudo pm2 startup -u myusername". Then "sudo pm2 save". And "sudo shutdown -r now" - of course.

@Unitech
Copy link
Owner

Unitech commented Dec 6, 2016

Closing in favor of #2559

To try the new startup system:

$ npm install Unitech/pm2#development -g
$ pm2 update
$ pm2 startup     # Then copy / paste the command displayed
$ pm2 unstartup

@Unitech Unitech closed this as completed Dec 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants