简体   繁体   中英

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?

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.

I think the syntax for args is meant to be something like this;

"args": ["--killSignal", "SIGTERM"]

However, in this case I think you're looking for;

"killSignal": "SIGTERM"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM