For watch for changes in a folder, I use incron, what is a equivalent to cronjob
See man incrontab
You must first install incron and GraphicsMagick
sudo apt-get install incron graphicsmagick
Add your username in /etc/incron.allow before to use incrontab
, then execute incrontab -e
and add the next lines (<path to watch> <file event> <script>)
/var/www/uploads/covers IN_CLOSE_WRITE,IN_DELETE /usr/local/bin/inotify.sh
$@ $ #$% /var/www/uploads/profiles IN_CLOSE_WRITE,IN_DELETE /usr/local/bin/inotify.sh $ @$# $ %