简体   繁体   English

来自外部创建文件的python pyinotify事件

[英]python pyinotify event from externally created file

I have a pyinotify instance watching a mounted network drive (mounted with CIFS) for IN_WRITE_CLOSE events which picks up the system created events (sudo cp, sudo mv, etc.) flawlessly if the server itself puts files in this directory. 我有一个pyinotify实例,它在监视装入的网络驱动器(用CIFS装入)中是否有IN_WRITE_CLOSE事件,如果服务器本身将文件放在此目录中,则它会完美地拾取系统创建的事件(sudo cp,sudo mv等)。

However, I would like to pick up the events for files that are created on this network drive by a different server and program. 但是,我想了解由其他服务器和程序在此网络驱动器上创建的文件的事件。

For some reason my inotify instance is not seeing these events...Is this normal behavior or could there be something wrong with my code? 由于某种原因,我的inotify实例没有看到这些事件...这是正常现象还是我的代码可能有问题? If this IS normal behavior, is there a way around it or do I have to find a different monitoring tool other than inotify to gather these events? 如果这正常现象,是否有办法解决?还是我必须找到一个不同于inotify的监视工具来收集这些事件?

UPDATE UPDATE

per @Cedric's answer I changed my mountpoint to NFS but I am still not getting any events. 根据@Cedric的回答,我将挂载点更改为NFS,但仍未收到任何事件。

According to this thread on the linux cifs client, this wasn't implemented (nor really scheduled) in 2009. 根据linux cifs客户端上的该线程该线程在2009年没有实现(也没有真正计划)。

For the NFS part, well, it works on NFS mount, but only if the listener is the same machine than the creater/modifer/deleter of the file.... :( ( source here ) 对于NFS的一部分,那么,它的工作原理上的NFS挂载,但只有当听众是同一台机器比文件的创建人/修改器/缺失者.... :(( 来源这里

Last, I ended by founding a hook ( just here ), this is a python script that you have to run on the remote server that will send to you the events (the script is made to talk to a MediaTomb server on http, but you can implement your own sender) 最后,我最后建立了一个钩子( 就在这里 ),这是一个必须在远程服务器上运行的python脚本,该脚本将向您发送事件(该脚本可以与http上的MediaTomb服务器进行通信,但是您可以可以实现您自己的发送者)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM