美文网首页
nodejs supervisor

nodejs supervisor

作者: demo11 | 来源:发表于2017-08-18 11:11 被阅读0次

node js中使用supervisor实时监测文件修改并自动重启应用的功能,从而避免大量重复的CTRL+C终止程序动作。

  1. 全局安装
    npm install supervisor -g

  2. 监测app.js的变化
    supervisor app.js

  3. supervisor 参数


//要监控的文件夹或js文件,默认为'.'
-w|--watch <watchItems>
//要忽略监控的文件夹或js文件  
-i|--ignore <ignoreItems>
//监控文件变化的时间间隔(周期),默认为Node.js内置的时间
-p|--poll-interval <milliseconds>
//要监控的文件扩展名,默认为'node|js'
-e|--extensions <extensions>
//要执行的主应用程序,默认为'node'
-x|--exec <executable>
//开启debug模式(用--debug flag来启动node)
--debug
//安静模式,不显示DEBUG信息
-q|--quie
  1. demo
supervisor myapp.js
supervisor -w py_scripts -e 'py' -x python myapp.py
supervisor -w lib, server.js, config.js, server.js

相关文章

网友评论

      本文标题:nodejs supervisor

      本文链接:https://www.haomeiwen.com/subject/mloorxtx.html