nodejs supervisor

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

  1. 全局安装
    npm install supervisor -g

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

  3. supervisor 参数


//要监控的文件夹或js文件,默认为'.'
-w|--watch 
//要忽略监控的文件夹或js文件  
-i|--ignore 
//监控文件变化的时间间隔(周期),默认为Node.js内置的时间
-p|--poll-interval 
//要监控的文件扩展名,默认为'node|js'
-e|--extensions 
//要执行的主应用程序,默认为'node'
-x|--exec 
//开启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)