Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [inotify]

The tag has no usage guidance.

0
votes
0answers
15 views

“Too many files” error, but no process exceeds maximum file limit

I am trying to open a file in a C process of mine, but it fails, and I see a "Too many files" error. So I checked all of my processes for how many files they were using, and none of the processes in /...
0
votes
0answers
9 views

Data partition and IntelliJ IDEA external file sync speed

I recently reconfigured the filesystem on my laptop so I can share my data with a second Linux. The Linux used in this matter is Fedora 28, 64-bit. My disks are now laid out like so: /dev/sda: /dev/...
2
votes
1answer
22 views

Alert or execute script, only if config file shows not in production mode

I would like to test the software in development by running a particular script, say script file.ext. But I was told that I an not allowed to run the script if a config file, say file.conf, contains a ...
2
votes
0answers
17 views

lsyncd: big directories

My plan was to use lsyncd to synchronize a directory with about 1,5m files and 0,3m directories to another host. Performance is not most important. After first tests I see that lsyncd uses inotify ...
1
vote
2answers
40 views

What is this `gmain` process with these unknown PIDs in my trace file?

Reading up on an answer to find out which process registered inotify watchers, I executed the following commands echo 1 | sudo tee /sys/kernel/debug/tracing/events/syscalls/...
1
vote
0answers
38 views

tail reopen file when directory changes

I've got a symlink pointing to the "latest" directory, and I want to tail a file in the latest directory, even if the symlink changes to a newly created directory. I often use tail -F for files and ...
1
vote
2answers
129 views

how to get the number of inotify watches in use

I use inotifywait for event trigger which put file. When many files are watched by inotifywait, when max_user_watches is exceeded, the following error occurs. Terminating since out of inotify ...
0
votes
1answer
28 views

finding a way to wait for an unknown named file to appear in a directory and then doing something with it

I have a dir called /media/simc/, I want to to set something up to monitor /media/simc/, and when a file is put in it (from this machine or any other on the network, it is a network mounted dir itself)...
0
votes
1answer
94 views

webpack dev server leading to freezing of the system

I was getting errors on using npm start in my react application. which goes like this ENOSPC system limit for file watcher reached I updated my npm and node versions but still i was getting this ...
2
votes
1answer
77 views

Source of this error: udevd [ PID ]: inotify_add_watch(6, /dev/sda, 10) failed: operation not permitted

We have this log in our syslog: udevd [ PID ]: inotify_add_watch(6, /dev/sda, 10) failed: operation not permitted Why do we get this error and how do we solve it? Our environment: Ubuntu 12.04; LXC;...
1
vote
0answers
70 views

inotifywait not working with Visual Studio Code

I tried to make myself a small shell script that would watch for file changes using inotifywait and copy modified/created files and delete deleted files to some destination folder (or rsync specific ...
0
votes
1answer
82 views

How would I use inotifywait to execute a command if a file in a directory is created, deleted or modified?

Here is the shell script I've got so far. I want it to check recursively, hence the following options: -r for recursive -m for monitoring -e for event notification and tracking For a reason unknown ...
0
votes
1answer
53 views

initifywait --exclude does not fire when there is at least one not excluded file

I am using this command to watch a directory: inotifywait -r -e modify,create,delete --exclude ".*(\.(git|idea)|(.*(___jb_tmp___|___jb_old___)))" my-dir However, it does not work like I intend. What ...
3
votes
1answer
126 views

Call a command, wait, then execute another command

This feels like a situation where I need to watch a stream (stdin), if a line comes in, wait a moment, then fire the command and wait some more. Using a tool like pyinotify or fswatch, we can watch ...
0
votes
1answer
67 views

How to read only the last line of a live input stream in a while read loop

I have a very simple bash script that synchronizes data to a USB key as soon as new files appear. It is poorly written but it works, however I want to minimize CPU time so I used sleep but since I use ...
3
votes
0answers
542 views

Alternative to inotifywait which allows easy working on *.json files only

It seems that inotifywait works with exclude lists only. I have seen the workarounds, but don't like them: How to use inotifywait to watch a directory for creation of files of a specific extension ...
0
votes
1answer
23 views

How to process series of files once transfer complete

What I have I have 2 servers. Lets call them sen.der and recei.ver. Sender generates files; these files can range in size from a 20Kb to 30 Gb. I've written a script that checks to see how big the ...
0
votes
0answers
183 views

How can I stop a running inotifywait from another script?

I have a script that starts up a perpetual inotifywait session (using the -m switch) that monitors a directory waiting for backup files to drop in and then moves them to another directory where they ...
2
votes
2answers
139 views

Have `xargs` run the arguments it's received every <maximum amount of time> instead of every `-n` arguments?

I am using fswatch and xargs to watch for file system changes, and run commands depending on which files are changing. fswatch prints the changed files to stdout, and xargs <my command> ...
2
votes
0answers
36 views

How to stop nginx sending status code partially written files to browsers? [closed]

I'm uploading video files to my Nginx server at /var/www/static. The files are sent from a separate machine. Sometimes these are large files, but are typically sent via an internal network. For ...
1
vote
1answer
352 views

Can't monitor Dropbox folder

I recently installed Dropbox on my computer running Debian 9.3. But it will not sync. When I mouse over the icon in the notification area of my toolbar, a message says... Can't monitor Dropbox folder ...
2
votes
2answers
269 views

How can I terminate a process if a second inotify event occurs?

inotifywait -q -m -e close_write,create --recursive ../orgmode-parse-print | while read -r filename event; do echo $filename; echo $event sleep infinity; done The problem with the above ...
0
votes
1answer
92 views

Shell: straightforward if statement seems not working

I've written this shell script snippet: while inotifywait -e modify $ENV_LOCATION/*.env do md5sum $ENV_LOCATION/*.env > ./checksums_optwo.md5 if [ -n "$(cmp ./checksums_opone.md5 ./...
1
vote
1answer
919 views

inotifywait exclude file types

I'm using inotifywait in a script and wondering if there is a way to exclude hidden files from being watched? I can't seem to determine the regex pattern to exclude hidden files.
4
votes
2answers
156 views

Potential workaround to inotifywait can't produce NUL-delimited output

I'm currently writing a bash script that uses inotifywait to perform certain actions on a user-supplied list of files and directories. It has come to my attention that unlike a lot of shell tools, ...
0
votes
1answer
79 views

Continuously transfer files to the server

I have linux client and linux server. Both are Ubuntu 16.04. On the client I generated .txt files almost every second, and I want to transfer them to the server, so my question is: what is the best ...
0
votes
2answers
57 views

Removing files under ~5k

I have 12 directores: /home/imp/hpt/boxes/110.110.2.0/ /home/imp/hpt/boxes/115.115.16.0 /home/imp/hpt/boxes/1.154.10.0/ /home/imp/hpt/boxes/44.100.0.0/ /home/imp/hpt/boxes/46.1.100.0/ /home/imp/hpt/...
2
votes
0answers
710 views

Failed to start Apply Kernel Variables

This is fragment of journalctl result: Jan 09 12:37:26 Host systemd[1]: Starting Apply Kernel Variables... Jan 09 12:37:26 Host systemd-sysctl[329]: Couldn't write '65536' to 'fs/inotify/...
0
votes
2answers
129 views

Inotify to duplicate the file from a directory that has been updated

I'm working on a system to backup logs. I need to copy logs in an other path in order to backup. I found inotify (that i do absolutely not know) that should help me on this task but i'm not sure... I ...
0
votes
1answer
378 views

Shell script to monitor windows directory

I need shell script to monitor the windows shared drive directory for any new file from the linux box and process the new file for further validation. I wrote the script using inotify-wait, but it ...
1
vote
2answers
66 views

What is mean of “not explicitly being listened” on manual page of inotifywait?

man inotifywait: delete_self A watched file or directory was deleted. After this event the file or directory is no longer being watched. Note that this event can occur even if it is not ...
0
votes
1answer
78 views

Check whether a file is opened or not

I have a folder, inside of which there are a lot of files. I was looking for a way to check whether any file inside that folder has been opened or not. If it is open, I need to get notified. I know ...
2
votes
2answers
705 views

inotifywait not alterting when device created

This works perfectly: $ inotifywait --event create ~/foo Setting up watches. Watches established. /home/ron/foo/ CREATE bar However, this just sits there when directory tun0 is created under /sys/...
1
vote
1answer
64 views

System unable to detect renamed/new files

Some months ago I realized when I am writing a new post on my blog (with Hugo), the feature to reload the contents as files changes stopped working. I waited in order to see if it was a problem with ...
5
votes
4answers
865 views

Monitor a burst of events with inotifywait

I have a service which is sporadically publishing content in a certain server-side directory via rsync. When this happens I would like to trigger the execution of a server-side procedure. Thanks to ...
1
vote
0answers
376 views

inotifywait and rsync is printing temporary file names

I am in the process of writing a bash script that will make a POST request to a remote server every time a new file is created in a directory. I use RSYNC to sync several directories to a main ...
5
votes
2answers
3k views

List current inotify watches (pathname, PID)

How do I get a list of: Pathnames currently being watched by inotify, and PID of the process watching I ask because I have found that syncthing's inotify watches were preventing my disk from being ...
1
vote
0answers
532 views

inotifywait script to watch file indefinitely, and restart process needs advice

I'm trying to write a script that will restart a process when the application configuration file is written to, using inotify. The script is supposed to act differently depending on which host it is ...
2
votes
2answers
778 views

systemd-path service not working

I have added a systemd service to monitor a path, but it is not working. I touched a .txt file under /tmp/test/, but it is not kicking in my service. I can't see "/tmp/testlog.txt" getting generated. ...
4
votes
0answers
429 views

What are the costs of increasing `/proc/sys/fs/inotify/max_user_watches` value?

In order to watch my home directory and all subdirectories recursively for 60 seconds: $ inotifywatch -v -r -t 60 /path You may get Failed to watch /path; upper limit on inotify watches reached! ...
2
votes
2answers
440 views

Edit inotifywait output in daemon mode

I've been making progress, but I'm not sure how to proceed from here. I'm using inotifywait with the -d (daemon) switch to output a file that lists the video files that are put into the watched folder....
2
votes
1answer
607 views

How to monitor whether a file was created?

I need to monitor if, for example, file /tmp/somefile123 was created after some events. I tried to use inotifywait but here is a problem: # inotifywait -q -e create /tmp/somefile?* Couldn't watch /...
3
votes
2answers
473 views

Unidirectional syncing/replicate large file incrementally

I have a binary file on a Linux server that is being actively appended by a process (written in C with a constantly open file handler and flushing non-ASCII buffer to this file). I would like to ...
1
vote
0answers
288 views

inotifywait to move a file after a user downloads it

I am about to loose my mind on this and note I am not a programmer but having to tackle since our programmers are to busy. We have an sftp server where a user downloads files from us. I need to be ...
4
votes
3answers
491 views

How to make a script run like a daemon waiting for changes in 2 files?

I am new to scripting, I made a script that reads 2 files and execute commands and as output a log file. I want this script to run like a daemon and wait for changes in these 2 files to execute these ...
2
votes
2answers
893 views

inotifywatch: continue watch after file rotation

I'm trying to write a script that uses inotifywatch to watch for changes in a log file. If a specific message is written to the log file, it's supposed to trigger a certain function. The script ...
1
vote
3answers
1k views

Sync same directories between two linux servers

There are two RHEL 7.2 linux servers located in different places. Both have same directory structure. Requirement is to keep certain directories of both servers in sync, i.e any modification in ...
15
votes
3answers
32k views

How to use inotifywait to watch a directory for creation of files of a specific extension

I have seen this answer. You should consider using inotifywait, as an example: inotifywait -m /path -e create -e moved_to | while read path action file; do echo "The file '$file' ...
3
votes
2answers
89 views

How to imitate the output of a webcam by updating a jpg file?

I have a folder A in which every now and then new files appear. It may happen that there are no new files for an hour, but also that there are several new files each second. All files have a unique ...
1
vote
0answers
21 views

How to check if a Token is valid in iComet server?

I'm working on a notification system using iComet. I need to check if channel's token is valid before sending notifications.