pm2启动无法在Ubuntu上启动 [英] pm2 Startup not starting up on Ubuntu
问题描述
在重新启动服务器时,我很难让pm2重新启动(自身和两个节点/表达文件,app.js
和app2.js
).
I am having difficulty getting pm2 to restart (itself and two node/express files, app.js
& app2.js
) on a server re-boot.
以下是我尝试过的过程:
Below is the processes I have tried:
pm2 startup
pm2 start app.js
pm2 start app2.js
pm2 startup ubuntu (also tried systemd and with/without -u username)
pm2 save
我以所有可能的组合方式运行了上述命令,但没有任何效果.我尝试以root身份运行,但也无法正常工作.
I ran the above commands in every possible combination and nothing worked. I tried running as root and it did not work either.
我的~/.pm2/dump.pm2
文件包含信息,所以我不确定其他地方.
My ~/.pm2/dump.pm2
file contains information so I am not sure where else to look.
我试图根据此问题修改我的/etc/init.d/pm2-init.sh
文件,但是没有帮助.
I have attempted to modify my /etc/init.d/pm2-init.sh
file according to this issue but it did not help.
我的设置:
Digital Ocean服务器
Ubuntu 15.10
节点v5.4.1
PM2 v 1.0.0
My Setup:
Digital Ocean Server
Ubuntu 15.10
Node v5.4.1
PM2 v 1.0.0
我尝试过的其他参考资料..
http://pm2.keymetrics.io/docs/usage/startup/
https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps a>
https://gist.github.com/leommoore/5998406
https://www.terlici.com/2015/06/20 /running-node-forever.html
https://serversforhackers.com/node-process-management-with-pm2
http://nodered.org/docs/getting -started/running.html#starting-node-red-on-boot
https://github.com/Unitech/pm2/issues/1316
Other references I tried..
http://pm2.keymetrics.io/docs/usage/startup/
https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps
https://gist.github.com/leommoore/5998406
https://www.terlici.com/2015/06/20/running-node-forever.html
https://serversforhackers.com/node-process-management-with-pm2
http://nodered.org/docs/getting-started/running.html#starting-node-red-on-boot
https://github.com/Unitech/pm2/issues/1316
到目前为止,每次我重新启动服务器时,pm2都无法自动启动(除非我需要等待几分钟?-nginx立即重启).
So far, each time I reboot the server, pm2 fails to startup automatically (unless I need to wait a few minutes? - nginx restarts instantly).
有人可以帮我这个忙吗?命令的运行顺序是什么?我需要修改其他文件吗?
Can someone help me out with this? What is the order in which the commands should be run? Do I need to modify any additional files?
推荐答案
您必须使用
pm2 start [app_name]
pm2 save
然后做:
pm2 startup [operation system]
这将创建dump2.pm2文件,pm2在重新启动时运行您的应用程序.
This will create a dump.pm2 file that pm2 needs to run your app on reboot.
操作系统:
- systemd :Ubuntu> = 16,CentOS> = 7,Arch,Debian> = 7
- 新贵:Ubuntu< = 14
- 启动:达尔文,MacOSx
- openrc :Gentoo Linux,Arch Linux
- rcd :FreeBSD
- systemv :Centos 6,Amazon Linux
- systemd: Ubuntu >= 16, CentOS >= 7, Arch, Debian >= 7
- upstart: Ubuntu <= 14
- launchd: Darwin, MacOSx
- openrc: Gentoo Linux, Arch Linux
- rcd: FreeBSD
- systemv: Centos 6, Amazon Linux
这篇关于pm2启动无法在Ubuntu上启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!