jsonangularjsnode.jsforever

Why not work " forever stop forever/development.json "?


I install forever npm package using follow command

sudo npm install forever -g
npm install forever-monitor

My server.js file run using follow command

forever start server.js

Result :

warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: server.js

Now server.js running background

Next server.js file stop using follow command

forever start server.js

Result :

info:    Forever stopped process:
    uid  command         script    forever pid  id logfile                       uptime       
[0] uiip /usr/bin/nodejs server.js 5763    5765    /home/amila/.forever/uiip.log 0:0:1:38.529 

Finally reading documentation, I added development.json inside forever directory

{
"uid": "app",
"append": true,
"watch": true,
"script": "server.js",
"sourceDir": "./"

}

Now Type :

forever start forever/development.json

Result :

warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: server.js

Now server.js file working.

Problem here : Type follow command

forever stop forever/development.json

Result :

error:   Forever cannot find process with id: forever/development.json

However when type

forever stop server.js

Result :

info:    Forever stopped process:
    uid command         script    forever pid  id logfile                      uptime       
[0] app /usr/bin/nodejs server.js 6437    6443    /home/amila/.forever/app.log 0:0:1:44.323 

I need now, Why when type forever stop forever/development.json comes error


Solution

  • If the forever process does not start properly, then it will automatically be stopped.

    So stopping a process, which is already stopped due to an error, then forever will throw an error for that

    error:   Forever cannot find process with id: forever/development.json
    

    Is development.json file contains below line?

    {  "script" : "server.js"  }
    

    Update:

    Valid Parameters

    forever stop Id|Uid|Pid|Index|Script