-
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
pm2-init.sh does not work on centos 7 #903
Comments
It's weird because it works if I power off the machine (unplug the power cable) but not if I run a correct reboot. Can anybody help me? |
Maybe we missed something. |
thing is, centos 7 uses systemd instead. It used to work correctly on centos 6 which used chconfig to enable/disable services |
Hi, i came across the same issue while using centos 7, I am running this under a normal user (not root) once i commented out the 'delete all' & 'dump' under stop in the initd script my apps kept coming back on reboot. |
Hi @Azerothian , Thanks a lot for sharing your solution! This indeed fix the problem. I also have change the |
@Azerothian worked on fedora =) yay! |
me too! |
Use this with CentOS 7: sudo pm2 startup systemd |
@Azerothian |
Feels to me like this needs more than a manual workaround. If we detect centos 7+ in the cli we should be able to do this correctly. Correct? Or there could be an optional version flag on the startup command. |
I also have problem with the startup pm2 on CentOS 7. It seems that these problems disappear if the application is run under
and then:
|
If on CentOS 7 run |
I played with pm2, and found two working way for CentOS 7 (in your project folder
# 2
NOT working next
and NOT working next
|
@KostyaTretyak Still not working here. |
@meteormatt, but if in your project to do this:
|
Here is what worked for me. (to launch Kibana4 under the node user on a RHEL/CentOS 7 server. Note about above: change the -u (user) node to what user you want the app to run as and the path to the startup file of the app. Now you should be able to reboot and it will run the app as the node user on startup. Hope this helps. |
Thanks @Azerothian, works like a boss. Just comment out '$PM2 delete all' in /etc/init.d/pm2-init.sh |
Thanks @Azerothian and I runned this command:
|
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 |
I am using The following command worked for me. I am running pm2 as node user not root.
update the user to
Under [Service], u should see the following [Service] the whole pm2.service file for reference cat /etc/systemd/system/pm2.service [Service] ExecStartPre=/usr/local/lib/node_modules/pm2/bin/pm2 kill ExecStop=/usr/local/lib/node_modules/pm2/bin/pm2 dump [Install] Reboot the server for test. Check /var/log/messages to verify pm2 started correctly. You would see something like this after reboot. Dec X 13:29:17 X.X.X.X pm2: [PM2] Spawning PM2 daemon with pm2_home=/home/node/.pm2 P.S. I think pm2 doesn't work well in centos 7 if you are using chkconfig, atleast I couldn't get it working |
In centos 7 when I reboot the server, pm2 does not load the processes saved on shutdown.
The service name (pm2-init.sh) also collides with systemctl format. Can I suggest to rename the file in just pm2?
The text was updated successfully, but these errors were encountered: