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
1081
votes
26 answers

How to retrieve a module's path?

I want to detect whether module has changed. Now, using inotify is simple, you just need to know the directory you want to get notifications from. How do I retrieve a module's path in python?
Cheery
  • 24,645
  • 16
  • 59
  • 83
352
votes
16 answers

Is there a command like "watch" or "inotifywait" on the Mac?

I want to watch a folder on my Mac and then execute a bash script, passing it the name of whatever file/folder was just moved into or created in the watched directory.
Mint
  • 14,388
  • 30
  • 76
  • 108
119
votes
8 answers

Is there anything like inotify on Windows?

With the Linux OS, there is the inotify subsystem which notifies an application of changes to the filesystem. However, I am mainly a Windows user, so I was wondering if there is a similar way to monitor filesystem changes?
johansson
  • 1,467
  • 2
  • 10
  • 9
105
votes
10 answers

How to monitor a complete directory tree for changes in Linux?

How can I monitor a whole directory tree for changes in Linux (ext3 file system)? Currently the directory contains about half a million files in about 3,000 subdirectories, organized in three directory levels. Those are mostly small files (< 1kb,…
Udo G
  • 12,572
  • 13
  • 56
  • 89
90
votes
12 answers

How to run a shell script when a file or directory changes?

I want to run a shell script when a specific file or directory changes. How can I easily do that?
Drew LeSueur
  • 19,185
  • 29
  • 89
  • 106
89
votes
7 answers

How do I find out what inotify watches have been registered?

I have my inotify watch limit set to 1024 (I think the default is 128?). Despite that, yeoman, Guard and Dropbox constantly fail, and tell me to up my inotify limit. Before doing so, I'd like to know what's consuming all my watches (I have very…
frio
  • 1,358
  • 1
  • 11
  • 14
69
votes
7 answers

inotify with NFS

I've recently created a dropbox system using inotify, watching for files created in a particular directory. The directory I'm watching is mounted from an NFS server, and inotify is behaving differently than I'd expect. Consider the following…
ajwood
  • 18,227
  • 15
  • 61
  • 104
61
votes
6 answers

What is a reasonable amount of inotify watches with Linux?

I am working on a daemon that monitors file events via inotify to trigger various types of events when files are accessed. I have read that watches are a little expensive, because the Kernel is storing the full path name of every file being…
Tim Post
  • 33,371
  • 15
  • 110
  • 174
60
votes
6 answers

Error: ENOSPC: System limit for number of file watchers reached angular

I am getting this error while doing my Angular 10 project. Error from chokidar (/myProject): Error: ENOSPC: System limit for number of file watchers reached, watch '/myProject/tsconfig.spec.json' Is there a method to resolve this error?
MikhilMC
  • 949
  • 3
  • 8
  • 14
53
votes
4 answers

What is the proper way to use inotify?

I want to use the inotify mechanism on Linux. I want my application to know when a file aaa was changed. Can you please provide me with a sample how to do that?
dubila
  • 1,099
  • 2
  • 10
  • 11
42
votes
6 answers

Asp.Net Core - The configured user limit (128) on the number of inotify instances has been reached

the asp.net core MVC report error after certain times of query to the mysql database (on Ubuntu 14.04/16.04) with the following message: "The configured user limit (128) on the number of inotify instances has been reached." It can be identified that…
imady
  • 453
  • 1
  • 5
  • 8
35
votes
5 answers

Too many open files - Failed to initialize inotify: the user limit on the total number of inotify instances has been reached

How can I fix below problem? I am using compass. Too many open files - Failed to initialize inotify: the user limit on the total number of inotify instances has been reached. …
verlager
  • 794
  • 5
  • 25
  • 43
30
votes
3 answers

inotify and bash

I am trying to make a bash script with inotify-tools that will monitor a directory and alter all new files by removing lines containing "EE". Once altered it will move the files to another directory #!/bin/sh while inotifywait -e create…
user963091
  • 357
  • 1
  • 3
  • 8
30
votes
1 answer

Difference between inotify and epoll

I would like to know what the difference is between both i/o watchers inotify and epoll? inotify inotify_init(void) creates inotify instance to read events from inotify_add_watch(int fd, const char * path, int mask) returns a watch fd around the…
bodokaiser
  • 15,122
  • 22
  • 97
  • 140
24
votes
3 answers

Best way to monitor file system changes in linux

I'm looking at building a file system sync utility that monitors file system activity, but it appears that some of the file system monitoring features in the linux kernel are obsolete or not fully featured. What my research as found dnotify came…
ReDucTor
  • 313
  • 1
  • 2
  • 11
1
2 3
42 43