Search code examples
node.jsforever

How to stop a forever process knowing the name


I have a node script in which I need to stop a forever process, before uploading the new version and restart it again;

the problem is that I only know the name of that process, and

forever stop processName.js

doesn't work, since it expect the index or the uid; is it possible to stop it knowing only the name?


Solution

  • Finally I got it, using a variable:

    uid=$(forever list | grep processName.js | cut -c24-27) && forever stop $uid