node.jsdaemonpm2process-management

How to kill the pm2 --no-daemon process


I'm using pm2 as the process manager of Node.js.

In many cases, I think I will run it as a daemon process, but if you use it locally as debugging, I think that there are times when you use the --no-daemon option.

How do I end the process when moving pm2 with this --no-daemon option?


Solution

  • You can try:

    pm2 kill

    or find the running PM2 process with:

    ps aux | grep PM2

    then kill with:

    kill -9 [pid]

    The -9 switch sends the KILL signal to the process as opposed to the default interrupt (INT or SIGINT) signal and is equivalent to -KILL or -SIGKILL. Interrupt is a less invasive way and you could try that first to let the process gracefully exit, however, if it doesn't respond to that, the kill signal should result in an immediate termination (unless the process is zombie).