inotify

inotify和rsync实现数据实时同步

左心房为你撑大大i 提交于 2019-12-06 13:12:13
数据的实时同步 实现实时同步 要利用监控服务(inotify),监控同步数据服务器目录中信息的变化 发现目录中数据产生变化,就利用rsync服务推送到备份服务器上 实现实时同步的方法 inotify+rsync 方式实现数据同步 sersync :金山公司周洋在 inotify 软件基础上进行开发的,功能更加强大 inotify: 异步的文件系统事件监控机制,利用事件驱动机制,而无须通过诸如cron等的轮询机制来获取事件,linux内核从2.6.13起支持 inotify,通过inotify可以监控文件系统中添加、删除,修改、移动等各种事件 实现inotify软件: inotify-tools,sersync,lrsyncd inotify和rsync实现实时同步 inotify+rsync使用方式 inotify 对同步数据目录信息的监控 rsync 完成对数据的同步 利用脚本进行结合 查看服务器内核是否支持inotify Linux下支持inotify的内核最小为2.6.13 ll /proc/sys/fs/inotify #列出下面的文件,说明服务器内核支持inotify -rw-r--r-- 1 root root 0 Dec 7 10:10 max_queued_events -rw-r--r-- 1 root root 0 Dec 7 10

Why won't Middleman include the rb-inotify and therubyracer gems once installed?

荒凉一梦 提交于 2019-12-06 08:52:29
问题 I have: $ ruby -v ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] $ middleman version Middleman 2.0.13.1 $ cat /etc/debian_version 6.0.3 if I start a project like so: $ middleman init np --rack --bundler --template=html5 create np/config.ru create np/Gemfile run bundle install Fetching source index for http://rubygems.org/ Using multi_json (1.0.3) Using activesupport (3.1.1) Using addressable (2.2.6) Using chunky_png (1.2.5) Using coffee-script-source (1.1.2) Using execjs (1.2.9)

Which Operating Systems support native (inotify-like) file watching in Java

给你一囗甜甜゛ 提交于 2019-12-06 04:46:59
问题 The JavaDoc for java.nio.file.WatchService states; The implementation ... is intended to map directly on to the native file event notification facility where available, or to use a primitive mechanism, such as polling, when a native facility is not available. I assume this means it will try a lightweight, native mechanism when it can (something like inotify on Linux) and poll if it can not. Is that correct? What operating systems are likely or unlikely to provide such a facility? Distro level

NodeJS Filesystem Watch throwing event twice or more often

此生再无相见时 提交于 2019-12-06 02:16:53
I'm watching the config files of my NodeJS server on Ubuntu using: for( var index in cfgFiles ) { fs.watch(cfgFiles[index], function(event, fileName) { logger.info("======> EVENT: " + event); updateConfigData(fileName); }); } So whenever I save a config file, the "change" event is received at least twice by the handler function for the same file name causing updateConfigData() to be executed multiple times. I experienced the same behavior when watching config files using C++/iNotify. Does anyone have a clue what causes this behavior? Short Answer: It is not Node, file is really changed twice.

inotify not firing notifications on file modification

前提是你 提交于 2019-12-06 00:42:56
问题 I have been tweaking the example here to make it repeatedly watch a file for 'modifications'. My code is here. In my tests the inotify notification is only firing the first time the file is 'modified'(i.e. touch 'ed). Any subsequent modifications to the file are not causing any notifications to fire. stat shows that the 'Modify' time has changed. Also, modifying the code to remove the watch and re-add each time a notification fires(i.e. move inotify_add_watch and inotify_rm_watch to be inside

Do any POSIX functions or glibc extensions implement a breadth-first file tree walk?

淺唱寂寞╮ 提交于 2019-12-05 21:36:54
I am writing a daemon that utilizes inotify to monitor file access and it is critical that I don't miss anything on a recursive search. I found this interesting idea and have begun to implement it. ftw() and ftw64() do not use a breadth-first algorithm, its more "pre-order". nftw() gives me the option of depth-first, but I'm worried about races in upper leaves. I'm hoping that I'm missing something, perhaps a GNU extension? Or am I just looking at implementing my own with type safe call backs (something I'd really rather not do) ? Or, is my understanding of the advantages of breadth-first over

编译安装inotify-tools和监控inotifywait事件

筅森魡賤 提交于 2019-12-05 17:23:55
编译安装 inotify-tools 软件包 1 )解包 inotify-tools-3.13.tar.gz 文件 [root@svr7~]#ls inotify-tools-3.13.tar.gz inotify-tools-3.13.tar.gz [root@svr7~]#tar xf inotify-tools-3.13.tar.gz-C/usr/src/ 2 )配置 ./configure ,安装目录默认( /usr/local/*/ ) [root@svr7~]#cd /usr/src/inotify-tools-3.13/// 进入源码目录 [root@svr7 inotify-tools-3.13]#./configure// 配置操作 checking for a BSD-compatible install.../usr/bin/install-c checking whether build environment is sane...yes checking for gawk...gawk .... configure:creating./config.status config.status:creating Makefile .... [root@svr7 inotify-tools-3.13]#ls Makefile// 检查配置结果 Makefile

Using inotify to keep track of all files in a system

ⅰ亾dé卋堺 提交于 2019-12-05 13:57:50
Question: Can inotify be used to reliably record files in a [linux] system? Details: I am attempting to use inotifywait to track users movements (currently using bash, but it has been suggested that I migrate to a scripting language). Ultimately I want to add new files to a database upon creation ( create , moved_from ), update existing rows in a database upon file modification ( modify , attrib , move_to ), and finally remove a row upon file deletion ( delete ). I am, however, running into many problems as even an action as seemingly simple as save , generates many inotifywait messages.

Linux: Triggering Shell Command On File Save

佐手、 提交于 2019-12-05 12:45:33
I want to automatically trigger a shell command when a file is modified. I think this can be accomplished in code by registering an inotify hook and call to system , however is there a higher level bash command that can accomplish this? Try inotify-tools. I'm having problems copying the link (sorry), but there is a wiki on GitHub which yu should be able to find with G-search-engine. I don't have a solution to your problem, but I've found this nice program that you might use the feature you request: cwatch 来源: https://stackoverflow.com/questions/10366411/linux-triggering-shell-command-on-file

inotify recursively how to do it?

大憨熊 提交于 2019-12-05 10:31:07
i need to print events on a folder with multiple subfolders. how to do it recursivly? Please print a c++ code. I am stucked!! Every time the evet is poped i need to open the subfolder, take the file and copy it into another directory. I don't want to list all the subfolders in every 2 seconds and find the files if there are any. Is not efficient. I need to use a monitor folder. Please help The director that i want to monitor has multiple subfolders. Each subfolder has another subfolder that could contain in a moment of time a file. MainFolder->Subfolders->each subfolder-> subfolder -> file.