Questions tagged [inotifywait]

inotifywait efficiently waits for changes to files using Linux's inotify(7) interface. It is suitable for waiting for changes to files from shell scripts.

Name

inotifywait - wait for changes to files using inotify

Synopsis

inotifywait [-hcmrq] [-e <event> ] [-t <seconds> ] [--format <fmt> ] [--timefmt <fmt> ] <file> [ ... ]

Description

inotifywait efficiently waits for changes to files using Linux's inotify(7) interface. It is suitable for waiting for changes to files from shell scripts. It can either exit once an event occurs, or continually execute and output events as they occur.

126 questions
15
votes
4 answers

How can I interrupt or debounce an inotifywait loop?

I have a little script that watches files for changes using inotifywait. When something changes, a batch of files are sent through a process (compiled, compressed, reorganised, etc) that takes about ten seconds to run. Consider the following…
Oli
  • 235,628
  • 64
  • 220
  • 299
15
votes
1 answer

inotifywait in docker-container doesn't register changes

I have a script running inside a docker-container which listens for changes in a directory via inotifywait. The directory is mounted to the host-system via docker -v. For some reason, inotifywait doesn't get triggered when files inside this…
Johannes Reuter
  • 3,501
  • 19
  • 20
12
votes
3 answers

Cannot install inotify on Amazon EC2

I have an AWS EC2 instance and wants to install inotify-tools. I've added the repository by executing the command: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm then execute yum install inotify-tools but…
marvinv
  • 181
  • 2
  • 9
12
votes
2 answers

How to watch file changes on Mac OSX using FSWatch?

I'm trying to use fswatch to translate the following lines from a linux bash script to be able to run it on Mac OSX: inotifywait -r -m 'myfolder/' | while read MODFILE do echo "something" done Since inotifywait doesn't work on Mac OSX I want to…
kramer65
  • 50,427
  • 120
  • 308
  • 488
7
votes
2 answers

inotifywait triggering event twice while converting docx to PDF

I have shell script with inotifwait set up as under: inotifywait -r -e close_write,moved_to -m "/upload" --format '%f##@@##%e##@@##%w' There are some docx files residing in watched directory and some script converts docx to PDF via below…
Jatin Dhoot
  • 4,294
  • 9
  • 39
  • 59
7
votes
5 answers

run inotifywait on background

I have this code copied from linuxaria.com as example and work just fine on my case the problem is when I exit from terminal inotifywait stop. I want run on back ground even after exit the terminal. how I can do that? #!/bin/sh #…
user1396982
  • 115
  • 1
  • 2
  • 9
6
votes
3 answers

inotifywait shell script run as daemon

I have a script that watches a directory (recursively) and performs a command when a file changes. This is working correctly when the monitoring flag is used as below: #!/bin/sh inotifywait -m -r /path/to/directory | while read path action…
Nicholas
  • 546
  • 1
  • 6
  • 19
6
votes
1 answer

How to listen only to specific events in inotifywait?

Can someone explain why inotifywait still reports about opened files, when I have excluded open? mkdir /tmp/a inotifywait --exclude acess,attrib,close_write,close_nowrite,close,open,moved_to,moved_from,move,delete,delete_self,unmount -r -m…
Jasmine Lognnes
  • 6,597
  • 9
  • 38
  • 58
5
votes
1 answer

inotify on docker mounted volumes (Mac / Linux)

I have been searching for a few hours and can't seem to find the most current answer to this problem Problem: Apparently VirtualBox is being used by Docker on MacOS and it does not want to pass file notifications from the Host OS to the container.…
OSUDamian
  • 161
  • 1
  • 12
5
votes
1 answer

How to use inotifywait to watch files within folder instead of folder

I want to use inotifyway to monitor newly created or moved file within a folder But only the files. Let's say my folder is name "watched_folder_test" and I have a file name "toto.txt". If I use the mv command to move the file to the…
Romain
  • 81
  • 1
  • 8
5
votes
3 answers

Python Inotify for a list of folders

I am looking for a way to check a list of document roots of 5 domains to inotify directory watch. For a single folder it is working like this DIRECTORY_TO_WATCH = "/home/serveradmin/" I have a list of folders which needs to be checked recursively…
Sumesh
  • 51
  • 4
5
votes
1 answer

Auto-reload pdf viewer while editing latex files

I use the llpp pdf viewer when editing my LaTeX files. To have it automatically refreshing the pdf file when I compile, I use a wrapper to launch it (cf. this). The part handling the waiting and refreshing is this one : inotifywait -m -e close_write…
Pece
  • 151
  • 1
  • 4
3
votes
0 answers

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 file). I was not able to make this work.…
gnivirht
  • 315
  • 2
  • 9
3
votes
1 answer

inotifywait is not killed with supervisorctl stop

I have this bash script running with supervisor #!/bin/bash DIR="/home/files" while read file; do IFS=', ' read -r -a array <<< "$file" echo "Time: ${array[0]}" echo "File: ${array[1]}" #... doing something with the file done <…
Optimus
  • 1,703
  • 4
  • 22
  • 41
3
votes
1 answer

Why does this simple email script sends two emails every time

Why does this script send two emails instead of one? #!/bin/sh MONITORDIR="/path/to/directory" inotifywait -m -r -e create --format '%w%f' "${MONITORDIR}" | while read NEWFILE do [ -z "${NEWFILE}" ] && : || MOVIE=$(find "$NEWFILE" -type f -not…
David Custer
  • 621
  • 1
  • 7
  • 11
1
2 3
8 9