Im running the following script to monitor the creation of new files, but its not quick enough. If two files get added at the same time, then this script only actions the first one.
Is there any way to tweak this to run faster or different?
#!/bin/sh
WATCHED_DIR=/var/www/magento/media/catalog/product
UPLOAD_DIR=/cloudfiles/magento/media/catalog/product
while :
do
echo 'Watching directory: '$WATCHED_DIR 'for new files'
while file=$(inotifywait -q -e create -r "$WATCHED_DIR" --format "%w%f")
do
loc=$file
rem=$UPLOAD_DIR${file#$WATCHED_DIR}
rsync --ignore-existing --inplace -q $loc $rem &
done
done