719513895
719513895

Reputation: 83

How to remove stopped process from forever list node js

remove stopped processes

Im using forever to keep node.js app running in the server. Is there a way to remove stopped processes from forever list?

Upvotes: 4

Views: 5190

Answers (2)

prodeveloper
prodeveloper

Reputation: 950

Execute forever list and get the desired process pid from the list (Eg. First column as in the below image)

Sameple

Execute kill <pid> in the terminal to remove the stopped process from forever list

Upvotes: 1

Lindsay-Needs-Sleep
Lindsay-Needs-Sleep

Reputation: 1441

Best I have found is to do ps -eaf

Then just kill eg. kill 30566

Now it should be gone from forever list. :)

NOTE: if your script is not currently stopped doing this will not stop it! It will only remove it from 'forever list'! (But you can stop it yourself by also killing it with it's PID.)

(Optional)

For fun, this should also return the pid of the forever process for the desired entry:

ps -ef | awk '$NF=="myScript.js" {print $2}'

NOTE: replace 'myScript.js' with the location/file you used in the 'forever start' command. (You can find this with 'forever list' under the script column.) It might be something like 'myServer/myScript.js'.

Upvotes: 3

Related Questions