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
check_version.png
使用:
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)
启动进程
forever_start.png
查看进程列表
forever_list.png
结束进程
forever_stop.png
重启进程
forever_restart.png
参考资料:
https://blog.csdn.net/baidu_25797177/article/details/72123264
https://www.npmjs.com/package/forever













网友评论