Show pm2 command that started a process

Solution 1:

As mentioned in a comment, use

pm2 describe

That will produce copious output similar to the following:

┌───────────────────┬─────────────────────────────────────────────────────────────────────────────────────┐
│ status            │ online                                                                              │
│ name              │ random                                                                              │
│ namespace         │ default                                                                             │
│ version           │ 1.0.0                                                                               │
│ restarts          │ 0                                                                                   │
│ uptime            │ 107m                                                                                │
│ script path       │ /home/pi/checkout/random-monitor.ts                                                 │
│ script args       │ N/A                                                                                 │
│ error log path    │ /home/pi/.pm2/logs/random-error.log                                                 │
│ out log path      │ /home/pi/.pm2/logs/random-out.log                                                   │
│ pid path          │ /home/pi/.pm2/pids/random-1.pid                                                     │
│ interpreter       │ /home/pi/.nvm/versions/node/v12.19.0/lib/node_modules/pm2/node_modules/.bin/ts-node │
│ interpreter args  │ N/A                                                                                 │
│ script id         │ 1                                                                                   │
│ exec cwd          │ /home/pi/checkout                                                                   │
│ exec mode         │ fork_mode                                                                           │
│ node.js version   │ 12.19.0                                                                             │
│ node env          │ N/A                                                                                 │
│ watch & reload    │ ✘                                                                                   │
│ unstable restarts │ 0                                                                                   │
│ created at        │ 2020-11-18T00:17:04.623Z                                                            │
└───────────────────┴─────────────────────────────────────────────────────────────────────────────────────┘

The interpreter, interpreter args, script path and script path should give you what you are after. See also this answer to a similar question.