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, only works after an ssh login #646

Closed
jamescam22 opened this issue Aug 23, 2014 · 10 comments · May be fixed by hixio-mh/pm2#5 or qsays/pm2#30
Closed

PM2 startup, only works after an ssh login #646

jamescam22 opened this issue Aug 23, 2014 · 10 comments · May be fixed by hixio-mh/pm2#5 or qsays/pm2#30

Comments

@jamescam22
Copy link

My user is called "ubuntu" on system ubuntu 12.04 and I run:
sudo pm2 startup ubuntu

I think have to login as "ubuntu" after server restarts in order for pm2 to actually startup.

Any ideas on what I can do to get it to work without having to ssh in after a restart?

@soyuka
Copy link
Collaborator

soyuka commented Aug 23, 2014

sudo pm2 startup ubuntu -u ubuntu

@jfroffice
Copy link

+1

I am on ubuntu 12.04 and it does not work.

sudo env PATH=$PATH:/home/toto/.nvm/v0.10.31/bin pm2 startup ubuntu -u toto

@jfroffice
Copy link

It seems that the error is file /etc/init.d/PM2-init.sh.

The path of PM2 is not good.

Since the user is connected with su -, it is not useful to specify the PATH every time.

pm2 = pm2 

super () {
su - -c $ USER "$ *" 
} 

it works for me.

@Unitech
Copy link
Owner

Unitech commented Aug 24, 2014

What was the path assigned to PM2 ? I just tried here everything is ok

@jfroffice
Copy link

/home/toto/.nvm/v0.10.31/lib/node_modules/pm2/bin/pm2

and the real path is

/home/toto/.nvm/v0.10.31/bin/pm2

@Unitech
Copy link
Owner

Unitech commented Aug 24, 2014

With nvm global package are linked

lrwxrwxrwx 1 xxxx xxxx 31 Aug 22 23:18 /home/xxxx/nvm/v0.11.13/bin/pm2 -> ../lib/node_modules/pm2/bin/pm2

But worth inspecting

@soyuka
Copy link
Collaborator

soyuka commented Aug 24, 2014

Indeed su - keeps the environment, we should change the log warning about sudo env PATH=$PATH:/home/toto/.nvm/v0.10.31/bin pm2 startup ubuntu -u toto to pm2 startup ubuntu -u user if it works. Should we?

@jfroffice
Copy link

maybe we should ask to Mooser if it works for him.

@soyuka
Copy link
Collaborator

soyuka commented Aug 28, 2014

@mooser any updates on this? Could you try to simply use pm2 startup ubuntu -u user?

Thanks.

@jamescam22
Copy link
Author

@soyuka I haven't had time to try yet. I will let you guys know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants