抑制或防止重复的inotifywait事件? [英] Suppress or prevent duplicate inotifywait events?

查看:385
本文介绍了抑制或防止重复的inotifywait事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前 inotifywait 正在监视git服务器文件夹。只有当特定文件被修改时,它才会发出。问题是,当更改推送到git服务器时, inotifywait 触发几次。我不知道为什么。

Currently inotifywait is watching git server folders. End it emits only when specific file modified. The problem is, when changes are pushed to git server, inotifywait triggers few times. I don’t know why.

那么我该怎么做:防止 inotifywait 产生重复?

So how can I do the next: prevent inotifywait from making duplicates?

我在考虑算法:第一次触发时 - >睡眠脚本,所以它不会扫描下一个更改5秒钟 - >恢复脚本。但它听起来很愚蠢......你能帮我实现这个目标吗?谢谢!!

I was thinking about the algorithm: when triggered first time->sleep script so it won’t scan next changes for 5 seconds->resume script. But it sounds idiotic... Can you help me achieving this? Thanks!!

推荐答案

正如我在其他问题,你可以首先设置一个post-receive钩子,每当有人对Git服务器进行推送时就会检查你的repo。

As I mentioned in your other question, you can setup first a post-receive hook which would checkout the repo for you whenever there is a push done to the Git server.

不仅可以在监视结帐时更改的文件时测试 inotify 函数,还可以使用 not > inotify ,并使用钩子触发您的通知。

post-receive hook可以列出文件,然后您就可以触发您的通知,仅限某些文件。

Not only can you test your inotify function when monitoring those files changed on checkout, but you could even consider not using inotify at all, and using the hook to trigger your notification.
A post-receive hook can list files, and you can then trigger your notification only for certain files.

这篇关于抑制或防止重复的inotifywait事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆