1

I'm using PM2 on a Windows server to run a bunch of different scripts. I have found that sometimes when I issue a stop with PM2 it reports the process as stopped but the node process is still running.

I want to be able to determine what script is being run by the node process (as reported by Windows task manager). If I was binding to a port I could figure it out with net stat but these scripts don't listen on ports, rather they connect to Rabbit MQ.

If I can identify the task in Windows I can forcefully terminate it using task manager.

Ken
  • 165
  • 1
  • 3
  • 11

1 Answers1

0

I think you're looking for tasklist /FI "Imagename eq node" (or something similar)

Related: https://superuser.com/questions/18830/is-there-a-command-in-windows-like-ps-aux-in-unix

Docs for tasklist: https://technet.microsoft.com/en-us/library/bb491010.aspx

Related, if your process is listening on a port and you know that number: How can you find out which process is listening on a port on Windows?

If you're connected to RabbitMQ your PID will be in the Consumers section of the queue, something like this: node-amqp-37997-0.5310617093928158 where 37997 is the PID of the process listening.

Community
  • 1
  • 1
jcollum
  • 36,681
  • 46
  • 162
  • 279
  • This shows me a list of all the node processes but they are all the same, I am unable to determine what script is associated with each node process. So close :) – Ken Oct 17 '16 at 15:47
  • Yeah I mentioned that in my OP. – Ken Oct 18 '16 at 13:17
  • Oh, RabbitMQ might be showing the PID of the consumer. See update. – jcollum Oct 18 '16 at 15:04