Pm2: Running in not daemon mode

Created on 18 Jan 2014  路  11Comments  路  Source: Unitech/pm2

I know it may sound a bit silly, but can I run pm2 in not daemon mode?

Let me explain why. I'm working on pm2 plugin for dokku, with dokku each process is started in docker container.

The problem is then I run, pm2 start processes.json it immediately quits, so docker assumes that it's done and stops.

Is that possible to have option like, pm2 start --no-daemon processes.json, so pm2 continues to run?

Most helpful comment

Just incase somebody googles this thread.
As of 2017 pm2-docker runs in --no-daemon mode instead of pm2

http://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/

All 11 comments

113

Yes would be interesting. Changing the way pm2 launch itself would be a quite big work.
An alternative would be to not exit ? And instead printing on the standard output the pid of the pm2 daemon ?

I know it's not very elegant but could it solve this problem ?

It would solve the problem, +1 for that change.

+1 For this - docker is gaining traction now

Want to follow-up on that.. So, no-deamon option is merged now, can this issue be closed?

How do I tell pm2 to also send stdout/stderr of its managed processes to the console?

currently when I start pm2 --no-deamon, only the pm2.log seems to be shown, not the logs of the process I just started.

you can do

$ pm2 start app.js
$ pm2 logs

We just fixed the --no-daemon command to also display processes output https://github.com/Unitech/PM2/commit/f4569cbebf9b56dba5c4edf9893261cd613f6fec

excellent, thank you.

Hello
It seems that when I start pm2 with --no-daemon it does not send data to keymetrics anymore... Am I right?

False alarm sorry about that, no problem

Just incase somebody googles this thread.
As of 2017 pm2-docker runs in --no-daemon mode instead of pm2

http://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/

pm2-docker was renamed to pm2-runtime but should still work as pm2-docker for now

https://pm2.io/doc/en/runtime/integration/docker/

Was this page helpful?
0 / 5 - 0 ratings