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
1
vote
1 answer

inotifywait not piping output to console

I have the following shell script running a inotifywait command. I want to print the output echo to the console upon every modify event. The script: #!/bin/sh while inotifywait -e modify -r -m ./ --exclude '\.sh$'; do echo test done When I change…
Mike Hawkins
  • 2,144
  • 5
  • 24
  • 42
1
vote
1 answer

monitoring and searching a file with inotify, and command line tools

Log files is written line by line by underwater drones on a server. TWhen at surface, the drones speak slowly to the server (say ~200o/s on a phone line which is not stable) and only from time to time (say every ~6h). Depending on the messages, I…
1
vote
1 answer

sleep inside inotifywait in a shell function not working

I am trying to run the following function foo () { sleep 1 echo "outside inotify" (inotifywait . -e create | while read path action file; do echo "test" sleep 1 done) echo "end" } Until inotifywait it runs…
manolius
  • 395
  • 3
  • 15
1
vote
0 answers

inotifywait: wait for some time after the first file was uploaded to server

I have a script that is sending email with directory tree when a new file is uploaded to server: #!/bin/bash SRC_DIR="/home/dir" make_action(){ mutt -s "Subj" user@mail <<< $(tree "$SRC_DIR") } IFS=' ' inotifywait -e create --format '%w %f'…
Michael
  • 5,095
  • 2
  • 13
  • 35
1
vote
1 answer

Using fs.watch on a directory does not seem to notice added files

When I use fs.watch on a directory: https://nodejs.org/docs/latest/api/fs.html#fs_fs_watch_filename_options_listener it does not notice new files added to the dir after fs.watch is called..I am on Linux - is there some call I need to make for it to…
user12849275
1
vote
1 answer

Safely pass data from a subprocess into async task with asyncio.Queue

I have a directory structure in an Amazon Linux EC2 instance. I would like to have a Python script asynchronously monitor this directory (and all subdirectories) for file creations. I've decided to run inotifywait in a subprocess and pass the output…
1
vote
1 answer

inotifywait - pause monitoring while executing command

I have the following command: inotifywait -q -m -e modify,create,delete,move -r /path/to/dir | while read; do custom_command; done This is running on the server. On my local, I'm doing an rsync up to the server. So, when the rsync runs, the…
Mr Mikkél
  • 2,577
  • 4
  • 34
  • 52
1
vote
1 answer

Inotifywait won't run

inotifwait won't run command "Setting up watches. Watches established" is output, script just exit #!/bin/bash while $(inotifywait -e modify,close_write /home/centos/test.txt); do touch /home/centos/log.txt done but when i modify test.txt…
user10205566
1
vote
1 answer

inotifywait -m | echo "found an event" doesn't stay open despite monitor switch

For whatever reason this command is quitting out after creating a single file in the folder. Not sure why when it is in monitor mode $ inotifywait -m /TDPROXY/NET_DISCONNECT/INCOMING/ -e create | echo "new file" Thanks
BostonMacOSX
  • 1,369
  • 2
  • 17
  • 38
1
vote
1 answer

Gitolite and non-bare repos?

Currently, I am tracking my repository with inotifywait. And it supports only flat files, so I created non-bare repo actually with git. But I decided to go to Gitolite and I can’t see anything about creating non-bare repo. Is there is an option?
Andrew Gorpenko
  • 187
  • 1
  • 1
  • 10
1
vote
2 answers

Suppress or prevent duplicate inotifywait events?

Currently inotifywait is watching git server folders. End it emits only when specific file modified. The problem is, when changes are pushed to git server, inotifywait triggers few times. I don’t know why. So how can I do the next: prevent…
Andrew Gorpenko
  • 187
  • 1
  • 1
  • 10
1
vote
1 answer

inotifywait with Docker command and variable

I am trying to create a shell script that will check for a new file then cp to a Docker Container. The code I have so far is... #!/bin/sh source="/var/www/html/" dest="dev_ubuntu:/var/www/html/" inotifywait -m "/var/www/html" -e create -e…
ThomasC
  • 97
  • 1
  • 11
1
vote
0 answers

why inotifywait command shows multiple pids?

i created one bash script named "quicktest.sh". the task of this script is to set inotifywait on Data folder from all users home directory. the code of quicktest.sh is down below: function inotify_data() { user="$1" if [ -d /home/$user/Data…
purval_patel
  • 385
  • 2
  • 11
1
vote
1 answer

How to detect that ftp upload is finished on a Linux server?

I'm using inotify-tools on CentOS 7 to execute a php script on every ftp upload. It's working fine, but there is one problem; when the upload gets aborted (for example if I stop uploading or close FTP client) then it still triggers the script. Is…
HTMHell
  • 5,761
  • 5
  • 37
  • 79
1
vote
1 answer

inotify script runs twice?

I'm using inotify-tools (inotifywait) on CentOS 7 to execute a php script on every file creation. When I run the following script: #!/bin/sh MONITORDIR="/path/to/some/dir" inotifywait -m -r -e create --format '%w%f' "${MONITORDIR}" | while read…
HTMHell
  • 5,761
  • 5
  • 37
  • 79
1 2 3
8 9