Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

mmmm

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mmmm

4m for tail wrapper

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

node-4m

4m for tail wrapper

npm version

我的场景说明

监控日志里最后一行是否包含特定字符,并触发回调

比如,监控日志里是否有finished字符,如果有,就给pub/sub服务器发送一个pub请求,继而由pub/sub服务器 通知浏览器端,完成更新内容。

Install

 npm install -g mmmm
 	 

Usage

第一步骤创建callback.js

touch callback.js

执行4m命令

4m -f file.log -e '/hadoop/g' -v

说明

  • f 文件名称

  • e 是要搜索的正则表达

  • v 是否打印日志

Example

see example.js

var file = 'file.log'
var search_content_express = /hadoop/g
var done = function(str,res){
	console.log("----"+str);
	var request = require('request');
	setTimeout(function(){
		request.post({
			url:'http://at35.com:4567/pub', 
			form: {
				key:'foo',
				value:'' + str
			}
		}, function(err,httpResponse,body){ 
			/* ... */ 
			if(err)
				console.log(err);
		})	
	},0);
	
}
	
var verbose = true;

require('./index')(file, search_content_express, done, verbose)

then open example.html with pub/sub

more detail see i5ting/fayeserver

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

版本历史

  • v1.0.0 初始化版本

欢迎fork和反馈

在issue提问或邮件shiren1118@126.com

License

this gem is released under the MIT License.

FAQs

Package last updated on 15 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts