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
21
votes
3 answers

How do I program for Linux's new `fanotify` file system monitoring feature?

fanotify, built on top of fsnotify, is supposed to replace inotify which replaced dnotify. Are there some good programming examples or existing utilities that use fanotify to watch for changes in a filesystem? How much detail does fanotify provide?
joeforker
  • 40,459
  • 37
  • 151
  • 246
17
votes
10 answers

Getting File Create Notifications for CIFS Mount in Linux

I have a windows share mounted via CIFS on an ubuntu server. I need to a way to know when a new file has been added to the Windows share. I tried this inotify program: http://www.thegeekstuff.com/2010/04/inotify-c-program-example/ Which works fine…
ofosho
  • 433
  • 1
  • 5
  • 15
16
votes
2 answers

How to check in python that a file in a folder has changed?

I need to know in python whenever a new file was added/removed/modified in a particular directory Is there a way for that? I'm looking for an "inofity"-like function (from POSIX). Thanks
Novellizator
  • 13,633
  • 9
  • 43
  • 65
15
votes
1 answer

Using read with inotify

I have been studying inotify call, but I still a bit flaky when it comes to the read interface. These are the most relevant resourses I could find regarding how to properly interface with inotify using…
Rafael Almeida
  • 2,377
  • 3
  • 22
  • 32
15
votes
4 answers

How can I interrupt or debounce an inotifywait loop?

I have a little script that watches files for changes using inotifywait. When something changes, a batch of files are sent through a process (compiled, compressed, reorganised, etc) that takes about ten seconds to run. Consider the following…
Oli
  • 235,628
  • 64
  • 220
  • 299
15
votes
1 answer

inotifywait in docker-container doesn't register changes

I have a script running inside a docker-container which listens for changes in a directory via inotifywait. The directory is mounted to the host-system via docker -v. For some reason, inotifywait doesn't get triggered when files inside this…
Johannes Reuter
  • 3,501
  • 19
  • 20
14
votes
5 answers

Is there a build tool based on inotify-like mechanism

In relatively big projects which are using plain old make, even building the project when nothing has changed takes a few tens of seconds. Especially with many executions of make -C, which have the new process overhead. The obvious solution to this…
Elazar Leibovich
  • 32,750
  • 33
  • 122
  • 169
13
votes
2 answers

Permanent fix to tail: cannot watch `log/development.log': No space left on device

I've been using Ubuntu 11.10 for a little over a week now. But after some time I encountered this error(the one in the title) when Im trying to access the log in my RoR project. I found a fix which is by pasting this in the terminal: sudo sysctl…
Normz
  • 271
  • 1
  • 2
  • 9
13
votes
6 answers

inotifywait - exclude regex pattern formatting

I am trying to use inotifywait to watch all .js files under my ~/js directory; how do I format my regex inside the following command? $ inotifywait -m -r --exclude [REGEX HERE] ~/js The regex - according to the man page, should be of POSIX extended…
gsklee
  • 4,774
  • 4
  • 39
  • 55
13
votes
1 answer

VS Code not excluding Code's node_modules from being watched - file watch limit reached

In VS Code, I have a Vue project with less than 50 files but upon running the dev server VS Code throws Error: ENOSPC: System limit for number of file watchers reached. My VS Code Watcher Exclude settings have the following ignore…
slanden
  • 1,199
  • 2
  • 15
  • 35
13
votes
2 answers

Change inotify.max_user_instances limit in Docker container

I am trying to change inotify.max_user_instances setting for docker env on the level of Dockerfile. I am trying to do it because I am receiving this error: Application startup exception: System.IO.IOException: The configured user limit (128) on…
phoenix
  • 365
  • 1
  • 4
  • 15
12
votes
3 answers

Cannot install inotify on Amazon EC2

I have an AWS EC2 instance and wants to install inotify-tools. I've added the repository by executing the command: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm then execute yum install inotify-tools but…
marvinv
  • 181
  • 2
  • 9
12
votes
4 answers

inotify file in C

I am trying to run an example of inotify in C..but it's not working. I want to monitor modifications to a file (the file is tmp.cfg), but it doesn't work..I don't know if i'm running it correctly, because I understand how to monitor directories, but…
mar_sanbas
  • 833
  • 2
  • 12
  • 20
11
votes
5 answers

Missing inotify events (in .git directory)

I'm watching files for changes using inotify events (as it happens, from Python, calling into libc). For some files during a git clone, I see something odd: I see an IN_CREATE event, and I see via ls that the file has content, however, I never see…
Michal Charemza
  • 25,940
  • 14
  • 98
  • 165
11
votes
2 answers

mod_wsgi: Reload Code via Inotify - not every N seconds

Up to now I followed this advice to reload the code: https://code.google.com/archive/p/modwsgi/wikis/ReloadingSourceCode.wiki This has the drawback, that the code changes get detected only every N second. I could use N=0.1, but this results in…
guettli
  • 25,042
  • 81
  • 346
  • 663
1
2
3
42 43