mardi 24 février 2015

Bash script to detect uploaded files triggers many times for one file


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


Aucun commentaire:

Enregistrer un commentaire