2

I have a simple bash script setup that uses the built-in inotify daemon running CentOS 6.6. The script will simply echo the file that is upload to a specific directory. The script works but it echos out the same filename over 100 times. I can't seem to figure out why it would do that.

#!/bin/bash

/usr/bin/inotifywait -e create,delete,modify,move -mrq --format %f /home/imgthe/public_html/run/thumbs --excludei sess_* | 
while read INPUT
do
    FILENAME=$INPUT

    DATE='date'

    echo $FILENAME
    printf $INPUT >> sku.txt
done

1 Answer 1

5

The modify attribute to inotifywait will notify you whenever the file is modified (i.e. written to). I suggest that you might prefer to replace create and modify with close_write.

1
  • Perfect. That did the trick. Thanks so much!!!!!! Feb 24, 2015 at 13:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .