Nodejs常驻后台运行
nodejs是通过命令行方式执行,当用户的xshell断开时Nodejs也就停止运行了。下面介绍几种办法让Nodejs常驻在后台运行
pm2(推荐)
1 | npm install -g pm2 |
nohup
1 | nohup node app.js & |
forever
1 | npm install forever -g |
nodejs是通过命令行方式执行,当用户的xshell断开时Nodejs也就停止运行了。下面介绍几种办法让Nodejs常驻在后台运行
1 | npm install -g pm2 |
1 | nohup node app.js & |
1 | npm install forever -g |