Can PM2 be used with compiled c programs
Asked Answered
F

2

10

Is it possible to use pm2 with custom c programs? If so, how is this accomplished? Does it work well? Is you are already using pm2 for node.js apps would it make sense to use it for a c program as well?

Favrot answered 29/3, 2016 at 16:48 Comment(0)
B
16

In order to run an precompiled executable file or binary, you need to add "exec_interpreter": "none" and "exec_mode" : "fork_mode" in your JSON file.

{
  "apps" : [{
    "name"       : "binary",
    "script"     : "./binary",
    "exec_interpreter": "none",
    "exec_mode"  : "fork_mode"
  }]
}

Sources: http://pm2.keymetrics.io/docs/usage/process-management/#start-any-process-type and https://github.com/Unitech/pm2/issues/1776#issuecomment-157560622

Buyse answered 27/3, 2018 at 4:21 Comment(0)
F
6

From testing it is as simple as specifying the executable file. For example to run a c program compiled to a.out use pm2 start a.out.

Favrot answered 31/3, 2016 at 1:44 Comment(2)
How do you start it with flags though? ThanksBuyse
pm2 start app.js -- -a 23 # Pass arguments '-a 23' argument to app.js scriptFavrot

© 2022 - 2024 — McMap. All rights reserved.