inotifywait

Send E-Mail on File Change in monitored directory

对着背影说爱祢 提交于 2020-05-15 18:36:27
问题 I want to send an e-mail notification to guys in our company if a file changed in their staff folder on the server. I have a script that works fine on sending an e-mail on every file change using inotifywait. What I would like to do is on multiple file uploads (lets say 10 jpg's are being uploaded to somebody's staff folder) to only send out one email. This script sends an email on every file change: inotifywait --recursive --exclude '.DS_Store' -e create -e moved_to -m /media/server/Staff

inotify script runs twice?

混江龙づ霸主 提交于 2019-12-12 04:33:25
问题 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 NEWFILE do php /path/to/myscript.php ${NEWFILE} done I can see there are 2 processes: # ps -x | grep mybash.sh 27723 pts/4 S+ 0:00 /bin/sh /path/to/mybash.sh 27725 pts/4 S+ 0:00 /bin/sh /path/to/mybash.sh 28031 pts/3 S+ 0:00 grep --color=auto mybash

inotifywait in docker-container doesn't register changes

房东的猫 提交于 2019-12-10 12:49:18
问题 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 directory is changed. This is the problematic script-line inotifywait -e create -e modify -e delete -e move /etc/nginx/sites-enabled The container is started like this (via fig) web: build: . ports: - "80:80" volumes: - ./conf:/etc/nginx/sites-enabled

Gitolite and non-bare repos?

南楼画角 提交于 2019-12-08 06:30:01
问题 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? 回答1: inotifywait waits for changes to files. If you want to monitor changes at the server level (where gitolite operates, behind ssh), you will need to add a non-update hook, typically a post-receive one, which will checkout the bare repo somewhere

Gitolite and non-bare repos?

爱⌒轻易说出口 提交于 2019-12-07 13:43:30
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? inotifywait waits for changes to files. If you want to monitor changes at the server level (where gitolite operates, behind ssh), you will need to add a non-update hook , typically a post-receive one , which will checkout the bare repo somewhere monitored by inotifywait . 来源: https://stackoverflow.com/questions/45270254/gitolite-and-non-bare-repos

How to watch file changes on Mac OSX using FSWatch?

末鹿安然 提交于 2019-12-06 23:52:37
问题 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 substitute the first line for FSWatch. Although the README refers to the fswatch man page, it doesn't provide a link to it and a search around the internet doesn't get me anything. So I tried messing around a bit. I created a folder called testfswatch/

Using inotify in a script to monitor a directory

无人久伴 提交于 2019-12-06 12:07:24
问题 I have written a bash script to monitor a particular directory "/root/secondfolder/" the script is as follows: #!/bin/sh while inotifywait -mr -e close_write "/root/secondfolder/" do echo "close_write" done When I create a file called "fourth.txt" in "/root/secondfolder/" and write stuff to it, save and close it, it outputs the following but it does not echo "close_write": /root/secondfolder/ CLOSE_WRITE,CLOSE fourth.txt can someone point me in the right direction? 回答1: You are not far away

Suppress or prevent duplicate inotifywait events?

末鹿安然 提交于 2019-12-01 14:44:23
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 inotifywait from making duplicates? I was thinking about the algorithm: when triggered first time->sleep script so it won’t scan next changes for 5 seconds->resume script. But it sounds idiotic... Can you help me achieving this? Thanks!! As I mentioned in your other question , you can setup first a post-receive hook which would checkout the repo for you

Suppress or prevent duplicate inotifywait events?

纵饮孤独 提交于 2019-12-01 12:37:37
问题 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 inotifywait from making duplicates? I was thinking about the algorithm: when triggered first time->sleep script so it won’t scan next changes for 5 seconds->resume script. But it sounds idiotic... Can you help me achieving this? Thanks!! 回答1: As I mentioned

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

蹲街弑〆低调 提交于 2019-12-01 09:05:35
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 watched_folder_test I got notify that I want Let's say inside the watched_folder_test I have a folder named foo and I create a file name 'bar.txt". I got the notification that I want. But here is my issue. If I have a folder name foo outside of watched_folder_test and I have a file name bar.txt inside it ( foo/bar.txt ) and I move that entire folder inside watched