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

Can I run inotifywait continually on a Linux Server without cron or incron

I create a git repo on the server for this dir. What I want to have is whenever there is a file moves into the directory, git push will push the repo and commit. I tried incrontab to execute a script. But seems like my server doesn't like incrontab,…
Kyle
  • 135
  • 1
  • 12
1
vote
0 answers

inotifywait does not work after running a period of time

I has running a daemon program to monitor a specific directory file changes, at the beginning, program is running normally, but after a period of time, inotifywait does work at the time of file changes. When i restart the program, it gets back to…
leidy
  • 11
  • 3
1
vote
1 answer

How to print file path that caused fswatch to do something

I use fswatch to take some actions when a file changes. I use the following command: fswatch -o -r '.' | while read MODFILE do echo 'Some file changed, so take some action' done this works fine, if I change a couple files I see the following in…
kramer65
  • 50,427
  • 120
  • 308
  • 488
1
vote
1 answer

Using expect and inotifywait to watch for changes in a folder on linux

I originally wanted to have a script that ran when I inserted a USB stick in my PC and then another script when it was removed, I messed around with udev with no success whatsoever so this obviously wasn't the best option, I then came across…
1
vote
1 answer

inotifywait output always has filename having .filepart

I am using inotifywait to monitor a large file transfer using WinScp: inotifywait --event close_write --event moved_to --format '%w%f %e %T' --timefmt '%F %T' $watchFolder | while read eventOutputInfo do echo "eventOutputInfo is:"…
jlp
  • 1,656
  • 6
  • 33
  • 48
1
vote
1 answer

Why does this inotifywait shellscript shop up with two PIDs?

I am learning to use inotifywait, specifically by using the script at: https://unix.stackexchange.com/questions/24952/script-to-monitor-folder-for-new-files. What I do not understand is why my scripts always appear two times when I use pid x. 36285…
tkja
  • 1,950
  • 5
  • 22
  • 40
1
vote
1 answer

How to get inotifywait to stop after a memory dump is complete?

So, in looking for a way to find out when a file is done being created to start the copy, I found inotifywait, but it doesn't seem to be working for me. I'm using Redline to dump a remote computer's memory, and have the script so that it can find…
Arvandor
  • 181
  • 1
  • 5
  • 15
1
vote
1 answer

inotifywait misses events while script is running

I am running an inotify wait script that triggers a bash script to call a function to synchronize my database of files whenever files are modified, created, or deleted. #!/bin/sh while inotifywait -r -e modify -e create -e delete…
AndrewVT
  • 335
  • 1
  • 8
1
vote
1 answer

Can inotifywait be used with a mounted S3 bucket?

I'm trying to setup a workflow in AWS. An S3 bucket contains the following folders: mybucket/todo mybucket/wip <- work in progress mybucket/done Another task dumps files into the 'todo' folder for processing. An Ubuntu EC2 instance has the…
Alex Woolford
  • 4,433
  • 11
  • 47
  • 80
1
vote
1 answer

Safe accessing inotified files

In a shell script I want to wait for a certain file to appear inotifywait -m -r -q -e close_write -e moved_to --format '%w/%f' $ARCHIVE_ROOT | while read FILE; do # Call other programs which process the file like stat or sha1sum done I would have…
abergmeier
  • 13,224
  • 13
  • 64
  • 120
1
vote
1 answer

inotifywait won't pass args when executed with php

I use inotifywait to watch a folder for new files, and send the path of the file to a php script to process it when "close_write" is detected. The command looks like this: inotifywait -e close_write --format '%w%f' -m -r /path/do/dir | while read…
user15063
0
votes
1 answer

How to specify file extension when using inotifywait

How do I specify file extensions to be monitored when using inotifywait ? Given this code cd "tmp" inotifywait -me close_write --format %f . | while read file do rclone move "$file" … done Where to add the file extensions in the code? I tried…
0
votes
1 answer

How to make inotifywait runs command in queue?

How to make inotifywait runs command in queue? According to this script that moves file automatically right after it is created cd "a specific folder" inotifywait -me close_write --format %f . | while read file do rclone move "$file"…
0
votes
1 answer

inotifywait: new event triggered while processing the older one

I have the following loop: while inotifywait -qq --event close_write "$filebs" "$filevp"; do do_something() done The problem is that, at certain times, two events are triggered one right after the other, so that while the code is do_something()…
robertspierre
  • 3,218
  • 2
  • 31
  • 46
0
votes
0 answers

How to deliberately slow down a program in Linux?

This may be a bit weird since I'm going backwards (instead of speeding up a program) but there's a reason for this. Currently, I have used a file watcher called inotifywait that watches the file changes of a running program. Let's say I have this…
1 2 3
8 9