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
0
votes
0 answers

Inotifywait not showing all events

I have this simple python program in script.py. import os os.mkdir('abc') with open('abc/readme.txt', 'w') as f: f.write('Sample text file') os.rename('abc', 'new_folder') Now, on a separate terminal, I ran this inotifywait command. This…
0
votes
0 answers

inotifywait moniter /etc/shadow file for password change is working only for the first time

I am trying to monitor the changes in the /etc/shadow file continuously using inotifywait. But, it is only detecting only the first event. sudo inotifywait -m -e attrib /etc/shadow | while read E; do echo "File modified" done This is the…
0
votes
0 answers

Why is inotifywait not executing the body of the while loop

I had inotifywait working well, and suddenly it has stopped working as I expected. I'm not sure what's happening. My script: #!/bin/bash while inotifywait -e modify foo.txt; do echo we did it done echo $? When I execute it, I get: Setting…
user717847
  • 695
  • 1
  • 6
  • 16
0
votes
1 answer

Monitoring file changes in linux, Looking for a specific line

Assume a linux system with 4 instances of minicom opened and reading serial data input from 4 devices. Each minicom instance is saving the log into the corresponding text file. Serial data is received triggered by specific phisycal events and each…
mehdi
  • 167
  • 11
0
votes
1 answer

inotifywait -m does not process more than 1 file after long running process

I have a script that detects files on close_write and runs an ~5 minute process on them. These files are written to the directory in batches of up to 100. The issue is that inotifywait only detects the first file in the batch and does not process…
Yllier123
  • 66
  • 14
0
votes
1 answer

Inotifywait executes bash script first time only

I am running inotifywait on CentOS 6 with the following script: #!/bin/bash # # Try to run inotifywait to execute .buildeach time a file is changed watch=~/vuejs/files outfile=/dev/null build_script=~/.build inotifywait --monitor --daemon --outfile…
Bryan C.
  • 129
  • 1
  • 9
0
votes
1 answer

inotifywait keeps aborting

I've had this little script: #!/bin/bash echo "every time script $1 is saved, run the script" while inotifywait -e modify -qq $1; do $1 $2 done which has been so immensely helpful for me when writing scripts (editing file in tmux left pane,…
alec
  • 345
  • 3
  • 14
0
votes
1 answer

How to monitor the /etc/shadow file with inotifywait?

I'm trying to monitor the /etc/shadow file as the root user and perform a specific set of actions once a change is made to that file. I want to use inotifywait to do so. However, whenever I monitor that file the body of the bash script is skipped…
0
votes
1 answer

Automatically run rule when file changes in Snakemake

When working on compiled documents (LaTeX, RMarkdown, etc), I usually set up a rule for make using inotifywait to watch the input files and automatically rebuild the output file whenever the input files change. For example: dependencies =…
Nick Ulle
  • 409
  • 5
  • 14
0
votes
0 answers

inotifywait - Only restarting ghci on every second save

The Script I have a short bash script that uses inotifywait to restart a ghci repl on a given file: #!/bin/sh $(while inotifywait -e close_write $1; do pkill ghc; done) & while inotifywait -e close_write $1 do sleep 2 stack ghci $1 …
dharmatech
  • 8,979
  • 8
  • 42
  • 88
0
votes
1 answer

bash -- execute command on file change; doubling issue + how to skip loop until command completes

I'm a bash noob, and I am trying to set up a sort of "hot reload" functionality for a project I'm working on using inotifywait. Ubuntu 20.04 if that matters. Here is what I hoped would have worked: inotifywait -m -r ../.. -e modify,create,delete | …
NotAnAmbiTurner
  • 2,553
  • 2
  • 21
  • 44
0
votes
0 answers

FFMPEG in Bash : Why ffmpeg doesn't convert the video automatically?

I'm doing a car live stream video system. I try to convert the video from .avi to .mp4. So I use inotify-tools to detect if a new file updated. Then I encounter a problem. When 4 video update at a same time. Ffmpeg only convert one video. It doesn't…
Xyanophat
  • 11
  • 4
0
votes
1 answer

output mountpoint on (usb)device detection

I want to create a bash script that will output the mount point from an inserted USB device. I have two commands (between "do" "and" done") that work separately but not together in a bash script. The script looks for a UUID file use the $UUID…
Coen17st
  • 147
  • 1
  • 9
0
votes
1 answer

inotifywait close_write does not trigger when folders are added to watched directory

I am trying to make a copy of completed files that are saved to the torrent save folder. I have created a bash script using inotifywait to watch the folder. My original script worked great with files and folders/subfolders. Once I replaced the "-e…
S. Ray
  • 1
  • 2
0
votes
1 answer

inotifywait not displaying correct path

I have a script to automate adding movie data to my website and download the correct subtitles for them by using inotify to launch other scripts. So that it only runs on the new file I need the complete file path like "/var/www/html/movies/my movie…
RobertW
  • 156
  • 14
1 2 3
8 9