-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Ubuntu Startup Script - Not Working #289
Comments
Which nodejs version do you use ? pm2 version ? |
My node version is - v0.10.24 just now i removed my startup script using "sudo update-rc.d -f pm2-init.sh remove" and reinstalled pm2 latest version. still the same. |
Can you do something like |
yes all the processes are up. |
Have you managed to fix this issue ? |
no, still I'm manually restarting pm2 after a system reboot. I think the issue is in my ubuntu installation. To be sure I ll test pm2 and my services in a fresh ubuntu server and see. |
I have the exact same problem on Ubuntu 12.04 with Node v0.10.25. It seems that the processes are not getting dumped, so there's nothing to resurrect. |
Had this issue too (debian 7), Workaround : It seems that the dumped result is lost after rebooting. Dump/kill/resurrect are working fine when executed. |
That's the obvious solution but this fancy dump / resurrect method should still be fixed. |
+1 The pm2 script has to be running when the shutdown takes place (or it won't be dumped). Only one restart script for pm2 should be provided. |
if i have multiple processes i have set my path to "processes.json" right ? or is it possible to add mutiple services to "pm2-init.sh" ? as you mentioned earlier. |
It looked like this : And take a look at the update-rc.d command if you're on ubutun/debian to make your own. But the dump/resurrect method is working. |
I was able to fix the problem. It seems that I was in the wrong directory while running the command to setup the init script. Everything works fine after setting the correct path to the user's home directory in export HOME="/home/www" I hope this helps. |
In my server "export HOME="/root" was already set. temporarily I'm using "su - root -c "pm2 resurrect" in my "/etc/rc.local". |
So, did you figure a way to make it work? |
No I'm not. Using rc.local to resurrect my process on startup. |
If it helps, I think I have a repro of this issue that can be created easily in vagrant: https://github.com/fschwiet/helloVagrant/tree/pm2-issue42900019
Here is a snippet from the Vagrantfile:
|
Thank you :) |
For reference to those running into this kind of issue, to keep pm2 running after reboot, I am using crontab:
Where provision.sites.sh is something like:
|
noted and thanks :) |
Seems like I've found issue why it does fail with vagrant. Have not found a solution yet. But anyway it has nothing to do with |
@kompot a solution for the vagrant + pm2 start on reload is to add an upstart script that takes care of restarting you app after vagrant has mounted the source. This is what I use: # /etc/init/vagrant-mounted.conf
description "Start pm2 on vagrant mounted"
author "Me"
start on vagrant-mounted
expect fork
setgid vagrant
setuid vagrant
script
export HOME=/home/vagrant
export PATH=/usr/local/node/node-default/bin:/usr/local/bin:/bin
cd /home/vagrant
pm2 start app.js
end script |
Thank you. :) |
how would start an app with pm2 after vagrant-mount on centos 7 (uses systemd)? |
Hello, I'm having the same issue:
The Thanks! |
On Ubuntu, I followed @soyuka advice. Edit |
I'm using ubuntu server 12.10. i have genarated the start up script and executed the given command, but i have to manually execute "pm2 restart all" to get my process online. I can see my process in pm2 after system start up. it show as online. but it's not.
The text was updated successfully, but these errors were encountered: