forever

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_第1张图片
forever_list.png

结束进程

forever_第2张图片
forever_stop.png

重启进程

forever_第3张图片
forever_restart.png

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

你可能感兴趣的:(forever)