Reputation: 6593
I have a script which is supposed to copy photos uploaded by admin users to our website to two other backend servers. To do so it does the following:
while true; do
inotifywait -e create "$TRANSFER_FILES" && \
sleep 20 && \
copy_files "$SSH_SERVER_1" "$REMOTE_DIR_1" && \
copy_files "$SSH_SERVER_2" "$REMOTE_DIR_2"
sleep 2
done
The sleep 20 is to give apache time to resize the uploaded images.
The problem:
If I create a file in the $TRANSFER_FILES directory (which is on a local filesystem), either as root or the apache user, with touch or cat or whatever, inotifywait receives the CREATE evenc and the copy_files function (wrapping rsync) is called. However, when the apache process creates the files, nothing happens.
Upvotes: 2
Views: 409