Process-watcher启动和控制 NodeJS 进程
Process-watcher 能够启动和控制 NodeJS 进程的工具。
代码示例:
var watcher = require('process-watcher');
/*
* Dummy metric monitoring object.
*/
var watcher_metric = {
/**
* Increments metric
*/
increment : function (name, v) {
// Add implementation as necessary
},
/**
* Set the metric or multiple metrics at the same time.
* */
set : function (names, v) {
// Add implementation as necessary
}
};
var dgpath = '/tmp/watcher_test_dgram',
statusPath = '/tmp/watcher_status_path_test',
watcher_config = { max_inactive : 0.001, monitor : 0.001, monPath: dgpath,
timeout : 30, timeout_start : 60 };
//Instantiate watcher
var watcher_instance = new watcher.Watcher({ metric : watcher_metric, config : watcher_config });
评论
