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?
Can PM2 be used with compiled c programs
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
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
.
How do you start it with flags though? Thanks –
Buyse
pm2 start app.js -- -a 23 # Pass arguments '-a 23' argument to app.js script –
Favrot
© 2022 - 2024 — McMap. All rights reserved.