Questions tagged [inotify]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
6 votes
1 answer
178 views

inotifywait ignoring new folders in watch directory

I am trying to use inotifywait to watch a folder (/shares/Photos) and when it detects a jpg added to the folder I need to resize it into a sub directory ($small_dir). Under the photos director there ...
user avatar
  • 63
0 votes
0 answers
30 views

Manual syncing of files each time it changes (between a desktop always connected home-wifi and a laptop that I carry around)

I know I have to use inotifywatch or something for this. I also know I can use rsync. I know that my connection should be made through SSH for better security but here's what I don't know: Where to ...
user avatar
  • 45
0 votes
0 answers
55 views

USB-Device and inotify

I'm looking a solution for being notified about files and directories modifications using inotify or any other API when the files are located on a filesystem on a custom board which is configured as a ...
user avatar
0 votes
1 answer
54 views

How to intercept file descriptor of file opened with inotify or others on access?

I just finished an Operating Systems course at my University, and I want to start playing with systems level programs with Rust. One of things I'm looking for is how to intercept a file descriptor of ...
user avatar
0 votes
1 answer
45 views

How to create a bash script that watches my local git repo and runs 'git log' every time I commit/checkout -b/push/status?

When I'm coding, I usually have 2 terminal tabs open in VSCode. The tab on the left is used for git commands. The tab on the right always has git log --all --graph --decorate --oneline showing me all ...
user avatar
  • 3
0 votes
1 answer
35 views

I need some service that trigger actions once after any file is created, modified, deleted, copied or moved

The problem is that I'm not being able to keep track of all my files and I'm also tired of not telling which ones are important and which ones are a temporary file that some random programmer decided ...
user avatar
0 votes
0 answers
49 views

inoticoming daemon started as service just vanishes

I'm trying to get inoticoming to start monitor a folder, and it's working if I start it manually, but I can't get it to autostart. I know it starts, because if I enters a non-existant directory it ...
user avatar
0 votes
1 answer
70 views

Segmentation fault (core dumped) when using inotifywatch

I need to watch a file system for the creation of new files of a specific type. Thinking that this would be a perfect use case for inotifywatch, I set out to try and make something work. I went to the ...
user avatar
  • 101
1 vote
0 answers
105 views

How to use a pattern when doing for loop of files in directory

I'm a novice bash scripter. Need help with the following. I have a script that uses inotifywait to watch a directory. Another process will drop a csv file in nightly. The file will be of the ...
user avatar
  • 11
0 votes
0 answers
28 views

Check if Files Where Updated on HDD Without Spin-Up

I am looking for a way to check if files were added/deleted/updated on a network shared HDD without spinning it up if possible. First I will start with my set up. I have an Asus Router (running Merlin)...
user avatar
2 votes
1 answer
67 views

Notify when programs access path only via specific symlink

My HDD mountpoint was at /mnt/old, now I changed it to /mnt/new So for seamless transition now /mnt/old is a symlink to /mnt/new. Gradually I want all the programs to use the new mountpoint. How can I ...
user avatar
  • 21
2 votes
2 answers
686 views

How to attach a listener to sysfs files?

How to watch for sysfs file changes (like /sys/class/net/eth0/statistics/operstate) and execute a command on content change? inotify does not work on sysfs I don't want to poll. I want to set a ...
user avatar
1 vote
0 answers
376 views

How is Inotifyd different from inotifywait in term of monitoring a directory and do some post actions?

I need to monitor a directory and do some post actions based on the events happened. I am familiar with inotifywait but since we use docker based on alpine, I was thinking about is there other way to ...
user avatar
1 vote
0 answers
221 views

NFS async mode causes inotify to fire multiple CLOSE_WRITE events

I have a nfs server and a client (v4, both CentOS 7.6/7.8) On the server I have a program which uses inotifywait to copy away incoming files (on CLOSE_WRITE) On the client the share is mounted like ...
user avatar
  • 175
1 vote
0 answers
13 views

Is there a way to get a list of every single directory watched by inotify on a system?

I'd like to obtain a complete list of what a particular program (not mine, installed as a package) is watching, because some notifications it generates make it appear to be looking at things it ...
user avatar
  • 1,076
0 votes
0 answers
66 views

One way hard link backup

a brief preface: I'm a real noob when it comes to Linux but I like to read and study. I have a folder where I place some files (let's say "/mnt/original_dir"). I want this folder to be ...
user avatar
3 votes
1 answer
280 views

Listing the files that are being watched by `inotify` instances

I got a little script that lists the number of inotify watches per process. That usually gets me what I want, but now I would like to know which files are being watched. I assume this is possible and ...
user avatar
  • 871
0 votes
1 answer
50 views

Detect changes in network status on SBC running Debian using inotify?

I have Debian 10 running on a small SBC (industrialized Raspberry Pi like form factor). I have some python programs running that make use of inotify capabilities. I want to detect when the network ...
user avatar
0 votes
1 answer
207 views

inotify only acts upon modification by root

On my Debian Buster system I want to run a bash script when a certain file is modified. I have created and enabled a service in /etc/systemd/system which looks like this [Service] ExecStart=/usr/local/...
user avatar
  • 131
0 votes
1 answer
104 views

monitoring xinput in script

My laptop has a cracked touchscreen that the local Asus tech tells me can't be replaced, not even with a non-touch because they just don't make them anymore. It is in all other respects a great laptop ...
user avatar
0 votes
1 answer
20 views

Is it possible to continuously feed parallel with more input?

What I want to do is something like this: inotifywait -m ./input -e close_write -e moved_to | parallel --max-args 1 "someSlowSingleThreadedTaskThatActsOnThisFile" I can't imagine that ...
user avatar
  • 142
2 votes
2 answers
175 views

How to use parallel with inotifywait?

I currently have this: inotifywait -m ./input -e close_write | parallel --max-args 1 "echo {1}" For some reason this doesn't do anything at all. The output of inotifywait is the same as ...
user avatar
  • 142
0 votes
1 answer
90 views

Inotifywait not executing when actions to be taken are on remote server

I am trying to monitor file creation with inotifywait and execute a long script on every file creation. Everything works smoothly when the action to be taken is on the same server. But when it ...
user avatar
  • 45
2 votes
1 answer
142 views

How to combine inotify with tail command to print last line of every modified file

I have this command this shows me when a file has been modified under a concrete directory (excluding some paths): inotifywait -m -q -r --format '%T % e %w%f' --excludei '/trash/' --timefmt '%d/%m/%Y-%...
user avatar
0 votes
0 answers
48 views

inotifywait not executing when files are created simultaneaously in watched folder

I am using inotifywait for executing automatically a script created with my web app in a given folder. I have setup inotifywait to watch file creation events in a folder and i am looking for a way to ...
user avatar
  • 45
0 votes
0 answers
97 views

How to monitor a directory for changes across reboots?

I'm searching for a tool that will allow me to run a program for every change in a directory, but is guaranteed to run exactly once per change even across system reboots. For the purposes of this ...
user avatar
2 votes
1 answer
100 views

awk behaving different with tail vs inotifywait

awk behaves differently when analyzing the output of tail -f versus inotifywait -m. Specifically I am searching for a matching string and want to exit awk once it appears. This works fine for tail -f, ...
user avatar
  • 10.6k
1 vote
0 answers
55 views

Inotifywait with counter does not work

I would like to run a command if there are 3 modifications events in the monitored directory. I have tried this, however, even though it works with the -m option, it does not work without the -m ...
user avatar
  • 31
0 votes
1 answer
32 views

My main goal is to monitor Tomcat directory, if any user modify files in tomcat directory; print that user name in the log;

#!/bin/bash watchDir="$1" watchDir2="$2" date1=$(date '+%Y-%m-%d-%H:%M:%S') inotifywait -m -r --exclude \.log "$watchDir" "$watchDir2" -e attrib,delete,...
user avatar
1 vote
1 answer
72 views

Awk's behaviour changes when inside a script

I have a text file, "invoice.txt" containing a line beginning "Vendor Invoice Number" which contains an order number field of the form RCTI- followed by alphanumeric characters ...
user avatar
  • 11
0 votes
1 answer
145 views

inotifywait - need help with nested if statements

I am monitoring a folder ($WATCHED) for new files (only .mkv)/folders. When something shows up it is to copy them to a Destination folder ($DESTINATION) and then change the ownership and permissions. ...
user avatar
  • 27
0 votes
1 answer
202 views

inotifywait - Rename file using just filename, not full path?

How do I use just the filename to rename files use this script syntax? #!/bin/bash WATCHED=/mnt/Watched DESTINATION=/mnt/Destination inotifywait -re CLOSE_WRITE,CREATE,MOVED_TO --format $'%e\t%w%f' -...
user avatar
  • 27
1 vote
1 answer
568 views

"inotifywait -e close_write" ignores new folders in watch directory

I am trying to make a copy of completed files that are saved to a watch folder. I have created a bash script using inotifywait to watch the folder. My original script worked great with files and ...
user avatar
  • 27
0 votes
0 answers
47 views

Unable to detect when a USB is plugged/unplugged with inotify [duplicate]

I'm trying to detect when a USB device (Android Device) is plugged into my computer. I know when I plug a device in, this file is changed /sys/kernel/debug/usb/devices and if I do a grep for the UDID ...
user avatar
3 votes
2 answers
186 views

How can I see how many inotify watchers a user has open?

When I run a command in a container, I'm getting inotify_init1() failed: Too many open files How can I see how many inotify watchers I have open and what's holding them open?
user avatar
  • 22.4k
0 votes
1 answer
206 views

Bash script for monitoring a directory and symlinking all newly created subdirectories and their files

I am in need of a bash script to recursively watch a folder and symlink every new file and subdirectory to another folder. this script correctly symlinks subdirectories and their contents: #!/bin/...
user avatar
2 votes
0 answers
56 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 ...
user avatar
  • 1,771
3 votes
0 answers
52 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 ...
user avatar
0 votes
1 answer
179 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 ...
user avatar
0 votes
1 answer
271 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 ...
user avatar
1 vote
0 answers
37 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 ...
user avatar
1 vote
1 answer
103 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, ...
user avatar
  • 3,277
0 votes
1 answer
164 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:...
user avatar
  • 131
0 votes
1 answer
217 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, ...
user avatar
  • 259
0 votes
1 answer
102 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 ...
user avatar
  • 1
3 votes
1 answer
197 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, ...
user avatar
0 votes
1 answer
221 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 ...
user avatar
0 votes
0 answers
278 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 ...
user avatar
0 votes
2 answers
466 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 ...
user avatar
  • 101
2 votes
1 answer
369 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 /...
user avatar