Questions tagged [inotify]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
13 views

inotifywait never prints the unmount event

From the manual page of inotifywait: EVENTS ... unmount The filesystem on which a watched file or directory resides was unmounted. After this event the file or ...
2
votes
0answers
20 views

Are inotify events guaranteed to come in the right order?

I have a single thread writing a stream of data into files in a directory. The data stream can pause for any length of time just as easily as it writes a continuous trickle of data. It writes one ...
0
votes
1answer
22 views

inotify - maintaining watch through log rollover

I have a inotifywait on syslog. It works without issue until the log rolls over. Although the same filename is used, the new file is a new file and inotify loses its reference. How do we compensate ...
0
votes
1answer
56 views

inotifywait with curlsftpsf mount point is not moving files as expected

I'm using Ubuntu 20.04. I'm trying to run this script for inotifywait. The idea is to move files from dir to target every time a change in directory occurs; this script is a shell file that can be ...
1
vote
0answers
29 views

Replace file with my own version when an external program changes it

I was wondering if anyone knew how to replace a file with my own version when an external program changes it. My system is running on ubuntu 20.04 Thanks in advance! Edit for clarity: when Minecraft ...
1
vote
1answer
38 views

Why isn't `inotifywatch --recursive /proc -v` able to see all created directories in `/proc`?

In one terminal I run the following command, which generates lots of directories in /proc over time: $ while true; do /bin/echo helloworld | cat -; echo $$; sleep 3s; done Then after several minutes, ...
0
votes
1answer
33 views

chmod command run within inotifywait doesn't work

I have the following bash script (which is saved as ~/fix-perms.sh): #!/usr/bin/env bash inotifywait -d -r -e close_write -o /dev/stdout ~/testdir | while read path event file; do sudo chown user:...
0
votes
1answer
29 views

inotify: avoiding a loop of repeated file changes

I am using inotify (implemented via pyinotify) on my Ubuntu 18.4 system in order to monitor creates, modifies, and attribute changes in certain directories. I use these watch flags: IN_CREATE, ...
0
votes
1answer
30 views

Run script when content of a file changes

I have a file with a word that changes when you move the vm on which the file resides. For example it says "test", but if I move the vm to another server it says "test1". Now as soon as the vm is ...
0
votes
1answer
59 views

Why doesn't inotifywait report modifications made to battery capacity file?

I want to know when my battery charge changes, and I don't want to simply run a daemon that checks on it every five seconds. I've tried running inotifywait -m /sys/class/power_supply/BAT1/capacity, ...
0
votes
1answer
26 views

Script in bash to scan a folder to move a docker file and execute it

I'm new here and I'm on a little project currently. I need to write a script in bash to scan a folder each time a file is dropped in it. In second part it should move it in a new directory created ...
0
votes
0answers
53 views

How does inotify work when multiple processes are watching the same files?

I have read some stuff about inodes and open file limits - what happens when multiple processes are watching the same files using inotify? is there ever a problem, or does the kernel/system handle ...
0
votes
0answers
32 views

How to use inotifywait to listen for file open / file read

Is there a way to use inotifywait to listen for when a file is open/read? using inotify to monitor access to a file
0
votes
0answers
16 views

inotifywait producing continuous events

I have this script that I expect will return one event per file open but it produces a continuous stream of open events. What is my error? #!/usr/bin/bash function checkevent() { echo "checking"...
0
votes
2answers
64 views

Use inotifywait to build after all files are copied

I am using inotifywait to copy files and the build them. But how do I get it to copy all the changed files and build once? A simple script will build 3 times per file changed (something to do with ...
2
votes
1answer
94 views

inotifywait not responding to change in /proc/mounts

I'm trying to get notification of the state of a problematic sshfs mount I have tried two bash scripts while inotifywait -e modify /proc/mounts; do echo "modified" done and inotifywait -m /...
1
vote
1answer
60 views

inotify: Echo which file has changed in directory

I've just learnt how to constantly check if file is modified: while inotifywait -q -e modify filename >/dev/null; do echo "filename is changed" # do whatever else you need to do done If I ...
0
votes
2answers
92 views

With inotifywait, exclude files that have certain extensions

I am watching incoming encrypted files which have two extensions, e.g., testfile<date>.dat.pgp. The problem is: once the file is decrypted, it creates a new file (testfile<date>.dat) in ...
0
votes
0answers
29 views

Monitor and execute with inotifywait but do it in a queue

I have a rtorrent + rutorrent setup which will move downloaded torrent content to ~/rtorrent/completed using autotools plugin. Inotifywait in background checks any new files that appears on ~/rtorrent/...
0
votes
2answers
45 views

Split behaving weird in bash

Trying to use split with inotifywait which basically splits the file when the file is created from ftp-server. #!/bin/bash TARGET=/home/test-directory/incoming SPLITTED=/home/test-directory/...
2
votes
0answers
141 views

Inotifywait not working on folders mounted via fstab

I'm trying to watch a folder via inotifywait which is mounted via fstab and originally located on an extern NAS. Inotifywait is reacting on any change done by SFTP-Connection or directly via terminal, ...
0
votes
2answers
359 views

Reliability of inotifywait loop

I have of bash script with a loop watching a directory recursively: while true do if path=`inotifywait -q -r -e create --format %w%f $watchpath`; then #modify file fi done If I'm not ...
1
vote
0answers
61 views

Do inotify watches automatically stop when a program ends?

Per man 7 inotify, there are a limited number of inotify instances (/proc/sys/fs/inotify/max_user_instances) and watches (/proc/sys/fs/inotify/max_user_watches). If inotify is set up using ...
1
vote
0answers
117 views

inotify stops reporting events

I am using inotify in a program written in C; it closely follows the example in man 7 inotify. The steps are essentially: /* setup */ int fd = inotify_init1(IN_NONBLOCK); int wd = inotify_add_watch(...
3
votes
1answer
2k views

What is exactly difference between INotify max_user_instances and max_user_watches?

After reading some articles on the internet I am a little lost in understanding the difference between INotify max_user_instances and max_user_watches. From official Linux man: /proc/sys/fs/...
0
votes
0answers
231 views

Use inotifywait to monitor folders and run script on a file when found

I am hoping someone could help me out. I am using a script that when pointed at a certain file in a folder, will generate a json file in that same folder. Below is the command used to run the script ...
0
votes
1answer
60 views

Process waiting for input from other process

I need to have a mechanism wherein 2 process should communicate. Process A will do some job and wait for input [file path] from another process B. Each time Linux machine is rebooted this should ...
0
votes
0answers
40 views

Continuously detect a change of chksum of files under folder with inotify-tools [duplicate]

I just installed inotify-tools. I would like to continuously detect change of chksum of files under folder /path Once a change was detect ( under /path ) then it will print echo “chksum of files ...
5
votes
1answer
114 views

How can I find what a process is trying to watch using strace, lsof, and fdinfo?

I have a process (the NewRelic infra agent) that is hung on a RHEL 7, xfs filesystem host. I'm thinking that it's trying to watch a file or maybe a socket that another process already has in use. ...
0
votes
1answer
88 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
29 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
44 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 ...
2
votes
2answers
330 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
51 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 ...
6
votes
2answers
3k 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
46 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
371 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
453 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
154 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
2k 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
338 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
349 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
103 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 ...
4
votes
0answers
1k 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
32 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
537 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
412 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
52 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 ...
2
votes
1answer
981 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
773 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 ...