【问题标题】:PM2 doesn't start the node process after rebootPM2 重启后不启动节点进程
【发布时间】:2019-07-18 16:21:36
【问题描述】:

我正在尝试在重新启动后自动启动一个进程。但它没有开始。我看到这样的消息:

[PM2] Spawning PM2 daemon with pm2_home=/home/my_user/.pm2
[PM2] PM2 Successfully daemonized
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app

我的步骤:

npm install -g pm2 - 在我的 centOS vps 上以 root 身份安装 pm2 globaly。

pm2 startup systemd -u my_user —-hp /home/my_user - 添加 pm2 到启动

su my_user - 切换用户

pm2 start --name myProcess app.js - 启动名为“myProcess”的进程

pm2 save - 保存当前进程列表。

以前它曾经工作过。 我现在做错了什么?

【问题讨论】:

标签: centos pm2


【解决方案1】:

@Nastro 请创建一个 run.sh 文件

#!/bin/sh

yarn
yarn start

pm2 start run.sh 并在集群中运行写入命令pm2 start run.sh -i max

这很好用!

【讨论】:

    猜你喜欢
    • 2018-10-24
    • 1970-01-01
    • 2015-12-22
    • 1970-01-01
    • 2014-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多