A simple CLI tool for ensuring that a given script runs continuously (i.e. forever).
You can use forever to run scripts continuously (whether it is written in node.js or not).
安装:
npm install -g forever
查看版本号
forever --version

使用:
forever start app.js
app.js
const http = require('http')
const server = http.createServer()
server.on('request', (req, res) => {
res.end('hello world')
})
server.listen(3000)
启动进程

查看进程列表

结束进程

重启进程

参考资料:
https://blog.csdn.net/baidu_25797177/article/details/72123264
https://www.npmjs.com/package/forever
网友评论