Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuild C program and run doesn't work #4442

Closed
georgii-ivanov opened this issue Oct 6, 2019 · 1 comment
Closed

Rebuild C program and run doesn't work #4442

georgii-ivanov opened this issue Oct 6, 2019 · 1 comment

Comments

@georgii-ivanov
Copy link

georgii-ivanov commented Oct 6, 2019

#3994 What's going wrong?

How could we reproduce this issue?

I'm trying to run make && ./server for C++ written program in order just watch and restart (recompile and run) Cpp-based microservice.

Supporting information

My PM2 configuration:

{
        "name": "capp",
        "cwd": "./capp",
        "watch": true,
        "script": "make && ./server"
 },

Shows this error:

[PM2][WARN] Applications capp not running, starting...
[PM2][ERROR] script not found : /var/capp/make && ./server

Tried also use /usr/bin/make && ./server but it doesn't work too.
If I run ./server separately that works
I suppose I can use sh file to run both command but make you know the way to avoid it?

$ pm2 report

--- PM2 report ----------------------------------------------------------------
Date                 : Sun Oct 06 2019 22:33:37 GMT+0000 (UTC)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 3.4.0
node version         : 8.10.0
node path            : not found
argv                 : /usr/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
uptime               : 5901min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 3.4.0
node version         : 8.10.0
node path            : not found
argv                 : /usr/bin/node,/usr/local/bin/pm2,report
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
cpus nb              : 2
freemem              : 1255292928
totalmem             : 8363065344
home                 : /home/ubuntu
===============================================================================
--- PM2 list -----------------------------------------------
┌──────────────────────────┬────┬─────────┬──────┬───────┬────────┬─────────┬────────┬──────┬────────────┬──────┬──────────┐
│ App name                 │ id │ version │ mode │ pid   │ status │ restart │ uptime │ cpu  │ mem        │ user │ watching │
├──────────────────────────┼────┼─────────┼──────┼───────┼────────┼─────────┼────────┼──────┼────────────┼──────┼──────────┤
│ app1       │ 1  │ N/A     │ fork │ 30277 │ online │ 1       │ 108s   │ 0.8% │ 105.0 MB   │ root │ enabled  │
│ app2           │ 3  │ N/A     │ fork │ 30290 │ online │ 1       │ 108s   │ 0.8% │ 104.7 MB   │ root │ disabled │
│ app3 │ 0  │ N/A     │ fork │ 30271 │ online │ 1       │ 108s   │ 0.6% │ 104.6 MB   │ root │ enabled  │
└──────────────────────────┴────┴─────────┴──────┴───────┴────────┴─────────┴────────┴──────┴────────────┴──────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/home/ubuntu/.pm2/pm2.log last 20 lines:
PM2        | 2019-10-06T22:29:09: PM2 log: App [capp] exited with code [0] via signal [SIGINT]
PM2        | 2019-10-06T22:29:09: PM2 log: Script /usr/bin/make had too many unstable restarts (16). Stopped. "errored"
PM2        | 2019-10-06T22:31:26: PM2 log: [Watch] Stop watching capp
PM2        | 2019-10-06T22:31:26: PM2 log: Stopping app:app id:2
PM2        | 2019-10-06T22:31:26: PM2 error: app=capp id=2 does not have a pid
PM2        | 2019-10-06T22:31:48: PM2 log: Stopping app:app1 id:0
PM2        | 2019-10-06T22:31:48: PM2 log: Stopping app:app2 id:1
PM2        | 2019-10-06T22:31:48: PM2 log: App [app1:0] exited with code [0] via signal [SIGINT]
PM2        | 2019-10-06T22:31:48: PM2 log: App [app2:1] exited with code [0] via signal [SIGINT]
PM2        | 2019-10-06T22:31:48: PM2 log: pid=29649 msg=process killed
PM2        | 2019-10-06T22:31:48: PM2 log: App [app1:0] starting in -fork mode-
PM2        | 2019-10-06T22:31:48: PM2 log: App [app1:0] online
PM2        | 2019-10-06T22:31:48: PM2 log: Stopping app:app3 id:3
PM2        | 2019-10-06T22:31:48: PM2 log: pid=29654 msg=process killed
PM2        | 2019-10-06T22:31:48: PM2 log: App [app2:1] starting in -fork mode-
PM2        | 2019-10-06T22:31:48: PM2 log: App [app2:1] online
PM2        | 2019-10-06T22:31:48: PM2 log: App [app3:3] exited with code [0] via signal [SIGINT]
PM2        | 2019-10-06T22:31:49: PM2 log: pid=29660 msg=process killed
PM2        | 2019-10-06T22:31:49: PM2 log: App [app3:3] starting in -fork mode-
PM2        | 2019-10-06T22:31:49: PM2 log: App [app3:3] online

@Unitech
Copy link
Owner

Unitech commented Oct 14, 2019

related to:
https://github.com/Unitech/pm2/blame/ebef87c8bcf8031419ce4de9c0e129b1e26e786c/lib/Common.js#L664
#3767

Fixed via:
24c3523

@georgii-ivanov could you try again with this pm2:

npm install Unitech/pm2#development -g

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants