Search code examples
javascriptjsonnode.jsargumentsforever

killSignal option in JSON config file with Forever module [node.js]


I'm using Forever with nodeJS and I want to use a config file (a JSON file) to start my server. I also want to use option --killSignal=SIGTERM , but i want it in the JSON file instead of using the CLI. Is that possible? I tried (according with Forever Documentation )with:

{ 
    "uid": "app",
    "append": true,
    "watch": false,
    "script": "app.js",
    "sourceDir": "/home/user/test/",
    "args": [" --killSignal=SIGTERM "],
    "logFile": "/home/user/test/log/foreverlog.log",
    "outFile": "/home/user/test/log/foreverlogOut.log",
    "errFile": "/home/user/test/log/foreverlogErr.log"
}

but the "args" line does not work. I also tried putting it as last line in the JSON file, or even putting

"script" : " --killSignal=SIGTERM app.js"

and

"sourceDir": "--killSignal=SIGTERM /home/user/test/"

but none of these works.

Am I missing something?


Solution

  • For now, I used a workaround. I created a config file and a start.sh file; the .sh file simply contains

    forever start --killSignal=SIGTERM ./config/foreverconfig.json
    

    I also created a stop.sh file which simply contains

    forever stop app.js
    

    This works correctly.