Ubuntu 14.04-重启后无法启动pm2启动 [英] Ubuntu 14.04 - pm2 startup not starting after reboot
问题描述
我正在使用pm2启动node.js进程,并且我希望在系统(Intel Atom处理器上的Ubuntu 14.04)启动时自动启动此进程.我已按照 pm2网站上的说明进行操作,但没有成功.我的dump.pm2似乎正确,但是pm2守护程序从未启动.我尝试了pm2 startup
的ubuntu
和linux
选项以及自动检测(无论是否指定用户).在/etc/rc[2-5].d
中创建了文件(链接)S20pm2-init.sh
,但是什么也没有开始.我在系统日志中找不到任何明显的错误消息.
I am using pm2 to start a node.js process, and I would like this process to be started automatically when the system (Ubuntu 14.04 on Intel Atom processor) is booted. I have followed the instructions on the pm2 web site but without success. My dump.pm2 appears to be correct, but the pm2 daemon is never started. I have tried both the ubuntu
and linux
options to pm2 startup
, as well as autodetect, both with and without a specified user. Files (links) S20pm2-init.sh
have been created in /etc/rc[2-5].d
but nothing gets started. I can't find find any obvious error messages in the system log.
有什么想法吗?
编辑以添加
我发现
从我的登录帐户运行时,service pm2-init.sh start
正确启动守护程序,该登录帐户与文件/etc/init.d/pm2-init.sh
中的USER=
定义的相同.我确保该文件中的PM2_HOME
定义也指向正确的位置.但是,它仍然无法在系统启动时启动!
I find that
service pm2-init.sh start
starts the daemon correctly, when run from my login account, which is the same as that defined by USER=
in the file /etc/init.d/pm2-init.sh
. I've made sure the PM2_HOME
definition in this file points to the correct place as well. However, it still doesn't start on system boot!
推荐答案
为使pm2启动正常工作,在这里.
For pm2 startup to work, there's a critical command buried in documentation and here.
您必须1)启动所有进程,2)创建启动脚本,3)运行
pm2 save
参考 @lazlojuly在这里的答案.
这篇关于Ubuntu 14.04-重启后无法启动pm2启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!