Questions tagged [inotify]
The inotify tag has no usage guidance.
167
questions
0
votes
1answer
15 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 ...
0
votes
1answer
11 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 ...
1
vote
2answers
21 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 ...
0
votes
1answer
14 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 ...
2
votes
1answer
30 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-%...
0
votes
0answers
29 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 ...
0
votes
0answers
17 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 ...
2
votes
1answer
55 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, ...
0
votes
0answers
23 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 ...
0
votes
1answer
28 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,...
0
votes
0answers
21 views
Restart a crashed screen
I have a simple bash script, which uses the inotifywait command and based on the modification that is done, I run an rsync command. This is done in an infinite loop.
The script is run in a "...
1
vote
1answer
53 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 ...
0
votes
1answer
41 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.
...
0
votes
1answer
47 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' -...
1
vote
1answer
67 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 ...
0
votes
0answers
12 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 ...
3
votes
2answers
49 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?
0
votes
1answer
56 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/...
1
vote
0answers
16 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
27 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
56 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
94 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
31 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
45 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
39 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
64 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
38 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
85 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
42 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
103 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
51 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
21 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
168 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
181 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
106 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
212 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
1answer
80 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
49 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
214 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
576 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
80 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
155 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(...
4
votes
1answer
3k 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
255 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
80 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
43 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
166 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
103 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
33 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
51 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 ...