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
-1
votes
2 answers

how to be notified of a program execution in linux

There is an inotifywait program from inotify-tools, which helps to detect creation, modification, opening and so on of watched files or directories, but there is no distinct "executed" event. I also have tried fileschanged utility, but it seems that…
sknaumov
  • 500
  • 4
  • 14
-1
votes
1 answer

How to monitor if a directory or file is renamed in C?

I am working on a monitoring project using inotify instance. I searched online to see if there is any way to monitor if the file or directory name is renamed. If it is not possible in inotify instance, how can I monitor a file or a directory in C…
Sky wifibrand
  • 109
  • 1
  • 6
-1
votes
1 answer

Unexpected return type with futures TryStream and SNAFU context

I am trying to wrap a stream of INotify Events, and I am not very successful: pub fn doc_stream( &mut self, ) -> Result, Error = Error> + '_, Error> { Inotify::init() .and_then(|mut…
-1
votes
1 answer

Inotify: monitoring only some files inside a folder

I'm writing a simple thread in C to monitor the modification to files inside a directory. There are several files inside the directory and some of them change frequently. I want to monitor few specific files. I read carefully the Linux manual but I…
-1
votes
1 answer

How to get notified if there is any changes in file system in USB device in linux or how to use recursively inotify

Could anyone please tell me is there any utility to detect if there are any changes in file system of connected USB? or can any one provide sample code for inotify recursively.
user7163017
-1
votes
2 answers

Can you help explain how this buffer logic works

I'm trying to do some work with inotify and better understand C in general. I'm very novice. I was looking over the inotify man page and I saw an example of using inotify. I have some questions around how exactly they use buffers. The code is…
Louis_Santos
  • 1
  • 1
  • 3
-1
votes
1 answer

Linux: Conflicts using inotify with fcntl

I'm having a strange linking issue after I included inotify in my program to monitor changes to a filesystem. The project includes in many other source files. However, when I include in the source file which is doing the…
Lars
  • 233
  • 2
  • 9
-1
votes
2 answers

Is there any way to get exactly which part of file has been changed on Linux

I want to build file sync software. Is there any way to get exact file changes (or at least changes size) with kernel systems like I-notify or others? EDIT: I'm interested in the following scenario with I-notify: When getting IN_MODIFY event on a…
-1
votes
2 answers

optimize a program with inotify

I write a program by inotify to check file change in loop for grab any changes to that. but i think this can be done better. can anybody write this code better? #include #include #include #include…
hamSh
  • 1,163
  • 1
  • 13
  • 27
-1
votes
2 answers

Monitor a log file for Mac Address using Perl and Linux::Inotify2 Module

I currently have my script here it is, my goal is to be able to monitor a live log file that is updated every second and as soon as my script finds this f8:27:93:88:1c:95 mac address it writes the line to a script. #!/usr/bin/perl my $mac =…
-1
votes
1 answer

inotify_init() Function Falied

I installed inotify and plugin code into my existing code for watch file.I am always getting message that inotify failed. I googled and found that kernel should with inotify option.(Not sure how will I check as I am using remote machine). I have…
user765443
  • 1,856
  • 7
  • 31
  • 56
-1
votes
2 answers

whats the correct way to loop this

I have a script where inotifywait is piped into a while loop that executes the following logic. cp "$S3"/2/post2.png "$S3"; mv "$S3"/1/post1.png "$S3"/2/post2.png; cp "$S3"/3/post3.png "$S3"; mv "S3"/post2.png…
sirvon
  • 2,547
  • 1
  • 31
  • 55
-1
votes
1 answer

using vsftpd with inotify IN_CLOSE_WRITE event

I'm trying to write event based ftp server that notifies me when some user uploads any file(users will never do any delete or other stuff, they just upload). Apache ftpServer with ftplets is what I need but it is java based and does not satisfy my…
Majid Azimi
  • 5,575
  • 13
  • 64
  • 113
-2
votes
2 answers

Confused with read() system call

I am very confused with read() calls to get inotify events. Here is the code: #define EVENT_SIZE sizeof(inotify_event) int fd = inotify_init(); int wd = inotify_add_watch(fd, dir, IN_MODIFY); void* p = malloc(sizeof(EVENT_SIZE)); read(wd, p,…
Abhinav Singh
  • 302
  • 3
  • 15
-2
votes
2 answers

How to get rid of the pointer from integer without a cast error?

I have made inotifyFunc to monitor two paths. Nothing is giving me an error except the last line [the code that I have taken from the main function] that is monitor.wd[0]. The error is warning: passing argument 3 of ‘inotifyFunc’ makes pointer…
1 2 3
42
43