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

Use inotifywait to change filename and further loop through sql loader

Objective: The moment multiple.csv files are uploaded to the folder, code should check each filename, if appropriate filename, file should be further used by sqlloader to get data uploaded in the database. Once file is uploaded, code should delete…
iotaa
  • 15
  • 3
0
votes
1 answer

Get an auto updated symbolic link to the latest file, based on grep on file name

So adapting this SO answer a bit is very close to the solution: ln -s target-directory/`ls -rt target-directory | grep .log | tail -n1` latest but how can I actually continously update the sym-link when a new file appears in the directory? Can this…
gies0r
  • 4,723
  • 4
  • 39
  • 50
0
votes
0 answers

Get variable from file to another file

I would like to get "file", "dir" and "action" variables from inotifywait and get them into "script.sh" to use them later on, if anyone can help: inotifywait -m PATH/TO/UPLOADS -e create -e moved_to | while read -r dir action file; do sh…
0
votes
1 answer

Most efficient way to get the path of a git repo which tracks a file

I am watching an arbitrary folder with inotifywait. When a file changes, I want to determine which git repo (if any) is relevant to that file. I see this answer: How to tell if a file is git tracked (by shell exit code)? The difference here is - I…
KC Johnson
  • 41
  • 1
  • 8
0
votes
2 answers

inotifywait secretely consumes a lot of memory

On Ubuntu 14.04: $ cat /proc/sys/fs/inotify/max_queued_events 16384 $ cat /proc/sys/fs/inotify/max_user_instances 128 $ cat /proc/sys/fs/inotify/max_user_watches 1048576 Right after computer restart I had 1GB of RAM consumed. After 20-30 minutes…
LLL
  • 1,777
  • 1
  • 15
  • 31
0
votes
1 answer

Why does inotifywait stop working consistently after a git checkout on the files it's watching?

I am running inotifywait on a directory of files: inotifywait --quiet --monitor \ --event modify \ --event moved_to \ --event moved_from \ --event move \ --event unmount \ --event create \ --format '%w' /path/to/*.json | \ while read…
J L
  • 400
  • 3
  • 15
0
votes
1 answer

How to monitor a directory with time and file using inotifywait?

I need to listen a directory, I can listen if a file is created in this directory and it works inotifywait -m -r -e moved_to -e create "$DIR" --format "%f" | while read f do if [[ $f = *.csv ]] ; then do something …
Neil John
  • 37
  • 9
0
votes
0 answers

How to use inotifywait to flag similar file names being added to directory

I have a shell program that uses inotifywait to run some code every time a specific file is added to a directory. However, my code works for only a specific file name. The files that are added to the dir have a version in their name that changes…
0
votes
1 answer

Automatically actioning remote copy of folder when local copy changes

EDIT: I see someone has voted to close this as "too broad a question", but the last time I posted asking how to do something, I was asked to provide more detail about what and why I wanted to do it. So... can't win! I'm only asking one…
digitaltoast
  • 659
  • 7
  • 23
0
votes
0 answers

inotifywait works on command but not on bash

My goal: run a Rscript when a file is created on directory /home/gabriel/data Here's what I have with inotiwait $ inotifywait -m -e create /home/gabriel/data | while read -r filename event; do Rscript /home/gabriel/script/updatedb.R; …
Gabriel Mota
  • 302
  • 1
  • 10
0
votes
0 answers

Moving the Usable File in Linux

In Centos 7 I am tracking a folder on the Samba Server with incrontab. I want to copy this folder to another folder when it is created. Before writing to the Samba server I first define the file path, the software copies it directly to the incrontab…
public_html
  • 309
  • 1
  • 4
  • 10
0
votes
1 answer

Inotify wait Copy Script Corrupting Images

So I have this script running, using inotifywait. One server puts images into a NFS folder on the host server at /var/nfs/device_images. (chmod is 777 on working folders) The host server then moves it into a working directory of a python…
0
votes
1 answer

Inotifywait not uploading entire file

I have a script to upload a file from a directory to an s3 bucket. My script is this aws s3 sync s3:/// And when I run this script the whole file is uploaded properly. I want to run this script whenever a…
Blue
  • 1,408
  • 4
  • 17
  • 36
0
votes
1 answer

runnig inotifywait to except file's change

I am running code that allows you to execute a command if flow.xml.gz changes: while inotifywait -e modify,move,create,delete flow.xml.gz; do echo "test"; done When I change the file nothing happens. I have only this…
amira khalifa
  • 107
  • 3
  • 11
0
votes
0 answers

inotifywait usage with rsyslog

I am trying configure inotifywait to look at my logs dir so I can send them to a logger like rsyslog and to a file. So far I have this: /usr/bin/inotifywait -e create,modify -dqs -o /newlogs /logs Here are the arguments for those trying to learn…
solaris
  • 311
  • 1
  • 4
  • 13
1 2 3
8 9