简体   繁体   English

如何用参数启动pm2?

[英]How to start pm2 with arguments?

I have a simple command that works fine when run: 我有一个简单的命令,可以在运行时正常运行:

parse-dashboard --config /home/ubuntu/dash/config.json

However, when running it with pm2, it doesn't work: 但是,当使用pm2运行它时,它不起作用:

pm2 start parse-dashboard -- --config=/home/ubuntu/dash/config.json

looking at the logs, i get the error: node: bad option: --config=/home/ubuntu/dash/config.json 查看日志,我得到错误: node: bad option: --config=/home/ubuntu/dash/config.json

What am I doing wrong? 我究竟做错了什么?

Use a process file where you specify the arguments. 在指定参数的地方使用过程文件。 Create the following file and name it for example ecosystem.json (make sure the 'script' and 'cwd' (where the app will be launched) locations are correct for you)) 创建以下文件并将其命名为例如ecosystem.json (确保“ script”和“ cwd”(将在其中启动应用程序的位置)对您来说正确))

{
  "apps" : [{
    "name"        : "parse-dashboard-wrapper",
    "script"      : "/usr/bin/parse-dashboard",
    "watch"       : true,
    "cwd"         : "/home/parse/parse-dashboard",
    "args"        : "--config /home/ubuntu/dash/config.json"
  }]
}

And run it with 并运行它

pm2 start ecosystem.json

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM