Questions tagged [inotify]

inotify is a Linux kernel subsystem that informs processes when files are accessed/created/modified or deleted.

The primary purpose of inotify is to prevent processes from regularly scanning file systems for changes which may be costly and have undesirable lags.

There is a command line interface and bindings exist for several languages including python, java, ruby, haskell, PHP.

To debug inotify related issues, you can log the actual events triggered by the inotifywatch tool. (part of the inotify-tools.)

633 questions
6
votes
0 answers

Is it possible to be notified each time ffmpeg finish processing one of multiple outputs?

I am trying to use a single ffmpeg command to encode a streaming url and generate many output files. In this example, ffmpeg will output three files of duration 5, 10 and 15 seconds: ffmpeg -i \ -t 5 output_5.wav \ -t 10 output_10.wav \ -t…
6
votes
3 answers

using stat to detect whether a file exists (slow?)

I'm using code like the following to check whether a file has been created before continuing, thing is the file is showing up in the file browser much before it is being detected by stat... is there a problem with doing this? //... do…
james edge
  • 121
  • 2
  • 6
6
votes
2 answers

trigger inotify event over NFS on Linux?

Can I trigger a filesystem event on Linux, without an actual file change? Is there some system call that acts like the file was written? Is that even possible? I have a NFS share mounted and want to get inotify events in the virtual machine, when a…
yvess
  • 1,992
  • 19
  • 17
6
votes
1 answer

Use INotify to watch a file with multiple symlinks

So I setup some code to watch a config file for edits, which worked until I used VIM to edit the file, then I had to also watch the directory for renames and creations. Then I discovered that didn't catch renames higher in the path hierarchy. Then…
Speed8ump
  • 1,307
  • 10
  • 25
6
votes
2 answers

inotify api stops working after reporting once or twice

I wanted to test inotify, so took a couple of examples from internet, modified it to learn various aspects, but failed as it didn't work like i wanted to. First i tried to watch over a directory where it worked pretty nicely. So i extended that…
Ayush choubey
  • 606
  • 6
  • 23
6
votes
3 answers

correct use of linux inotify - reopen every time?

I'm debugging a system load problem that a customer encounters on their production system and they've made a test application that simulates the load to reproduce the problem: In this particular workload, one of the things the coder did was…
MikeyB
  • 3,288
  • 1
  • 27
  • 38
6
votes
1 answer

How do I (recursively?) monitor contents of new directories using inotify?

Firstly, I want to start by using inotify to monitor a specific directory (the main directory) for files and sub-directories. If a new directory is added into this main directory, how would I make sure to monitor this sub-directory with inotify? How…
StarShire
  • 189
  • 2
  • 10
6
votes
1 answer

Is there something like USN Journal on Linux filesystem?

I often use Everything (a search tool) on Windows. It uses USN Journal to speed file name search. Do Linux filesystems (ext4, xfs, btrfs, etc.) have a similar function to USN Journal?
ibear
  • 127
  • 5
6
votes
2 answers

inotify don't treat vim editting as a modification event

my example code below watches a file for being modified. let's say the file being wathched is foo.txt, and the binary name came out from the sample code is inotify. I did two test for the sample code. test1: 1) ./inotify foo.txt 2) echo "hello" >…
Haiyuan Zhang
  • 40,802
  • 41
  • 107
  • 134
6
votes
2 answers

Make inotifywait group multiple file updates into one?

I have a folder with Sphinx docs that I watch with inotifywait (from inotify-tools). The script re-builds the html & singlehtml and refreshes Chrome. #!/bin/sh inotifywait -mr source --exclude _build -e close_write -e create -e delete -e move |…
culebrón
  • 34,265
  • 20
  • 72
  • 110
6
votes
1 answer

Adding watches to Inotify in multi-threaded program

I wanted to use inotify for monitoring some files in my C program. I am wondering if it is safe to have one thread reading from inotify descriptor (the one returned by inotify_init) thus blocking until some event happens, during this waiting there…
Andna
  • 6,539
  • 13
  • 71
  • 120
5
votes
1 answer

How do I avoid this race condition with readdir/inotify?

Suppose I want to invoke some command on all files in a directory and set a watch to invoke that command on all files that get created in that directory. If I do: while( ( sdi = readdir( d )) != NULL ) { ... } closedir( d ); /* Files created here…
William Pursell
  • 204,365
  • 48
  • 270
  • 300
5
votes
1 answer

inotify on docker mounted volumes (Mac / Linux)

I have been searching for a few hours and can't seem to find the most current answer to this problem Problem: Apparently VirtualBox is being used by Docker on MacOS and it does not want to pass file notifications from the Host OS to the container.…
OSUDamian
  • 161
  • 1
  • 12
5
votes
1 answer

File modification watch (Webpack, Guard...) issue over NFS in Virtual Machine (VM)

I know there are multiple threads discussing NFS mounted volumes and file modification watch issues. Since most of the discussions are old, some from 8 years ago, my goal here is to compile some and bring them up again to check what are the most…
brngyn
  • 96
  • 6
5
votes
1 answer

How to use inotifywait to watch files within folder instead of folder

I want to use inotifyway to monitor newly created or moved file within a folder But only the files. Let's say my folder is name "watched_folder_test" and I have a file name "toto.txt". If I use the mv command to move the file to the…
Romain
  • 81
  • 1
  • 8