5

I have a dedicated box running minidlna on Debian sourcing media files from a shared cifs drive.

When I add a new file to the share not using the midia box, minidlna does not recognize the new files as an inotify event is not created.

I found a workaround to make it recognize new files running touch from the media box from time to time but it does not work for folders as minidlna only identify IN_CREATE & IN_MOVED_TO events for folders and touch does not create these events for folders.

So I'd like to know if there is any other way to create this "fake" events or if you know how can I have one of these events for a folder without having to move it.

4
  • Not sure if you mean media box, also have a look at the edits I made, no need to type <br><br>.
    – Anthon
    Nov 6, 2014 at 12:35
  • Yeah, it's media box, thanks for your changes. Nov 6, 2014 at 20:00
  • Can you touch a zero sized hidden file? Say your media files are in /var/blah/media/pictures. Just touch a .touchme and that should generate the correct inotify event. Would this work?
    – Lmwangi
    Apr 17, 2015 at 10:11
  • Touch command works if I want discover a single file, but the problem is that it does not work when I need identify a folder and all inside it. I already tried this. Apr 19, 2015 at 23:09

2 Answers 2

0

What happens if you mount -o remount the CIFS filesystem?

This sounds like it is a bug in the CIFS implementation, in that directories are not triggering the notify events correctly.

I could find no references regarding event injection into an existing inotify stream. I suppose it could be done using SystemTap, but that's not practical. A better solution is to file a bug report on ReadyMedia (current name for the project at SourceForge.net).

I had a quick look at the code for notify.c at SF.net and it looks good, but just 30 seconds made it clear there was a memory leak in the code that adds/removes watches. :( However, it looks like modifying the code to properly support notify on directories wouldn't be tough.

0

If you know what file you would like to fake an inotify event for, this trick might help:

chmod $(stat -c %a $filePath) $filePath

Sets the same attributes back to the file, changes nothing, but inotify is triggered.

If you don't know the specific file that changed, you can use fswatch with its poll monitor that does not rely on events:

fswatch -r -m poll_monitor $folderPath

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.