[Whole Web, Node.js, PM2] Restarting your node.js app on code change using pm2

Aadd watch to the config.json file:

{
"apps": [{
"name": "App1",
"script": "app1/server.js",
"log_file": "log/app1.log",
"error_file": "log/app1-err.log",
"watch": true,
"ignore_watch": ["file"] //inside app1 folder
},{
"name": "App2",
"script": "app2/server.js",
"log_file": "log/app2.log",
"error_file": "log/app2-err.log"
}]
}

[Whole Web, Node.js, PM2] Restarting your node.js app on code change using pm2

After change app1/server.js, run

pm2 list

You can see App1's pid is changed, but App2 is not. Because we enable the watch on App1 not on App2.

上一篇:Android Linux自带iptables配置IP访问规则


下一篇:Android 之 布局训练